Assuming your question is correctly phrased, and this is really for display, and not for business processes (which would be a completely different question) ...
Do it in your presentation model. Add the inputs you need, project onto them and calculate the result. Here is a very trivial example. The real world is more complicated.
class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
class PersonPresentation
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string DisplayName
{
get
{
return string.Format("{0} {1}", this.FirstName, this.LastName);
}
}
}
public ActionResult DisplayPeople()
{
var model = from p in Repository.AllPeople()
select new PersonPresentation
{
FirstName = p.FirstName,
LastName = p.LastName
};
return View(model);
}
source
share