What's the correct approach for passing data from several models into a service?
- by Doug Chamberlain
I have an AccountModel and a page where the user can upload a file. What I would like to have happen is when the user uploads the file. The PageController does something like the following. this is a quick attempt just written in the question to illustrate my question.
public class PageController : Controller {
private Service service;
public ActionResult Upload(HttpPostedFileBase f){
service.savefile(f,_AccountModel_whatever.currentlyloggedinuser.taxid) }
}
public class Service
{
// abunch of validation and error checking to make sure the file is good to store
}
Wouldn't this approach be in bad practice? Since I'm making my controller dependent on the existence of th AccountModel? This will become a HUGE program over the next few years, and I really want to maximize the quality of the framework now.