MVC Model State

Posted by gnome on Stack Overflow See other posts from Stack Overflow or by gnome
Published on 2010-03-22T15:04:56Z Indexed on 2010/03/22 15:11 UTC
Read the original article Hit count: 260

Filed under:

Greetings On all my controllers I recycle the same code that wraps my models and to accesses the service layer -- and I'm tired for copy / pasting it into each controller:

private IProjectService _service;
public New()
{
_service = new ProjectService(new ModelValidation(this.ModelState));
}
public New(IProjectService service)
{
_service = service;
}

Is there someplace where I can place this where all my controllers access it?

© Stack Overflow or respective owner

Related posts about asp.net-mvc