Ok, I'm not talking about making business logic decisions, but rather UI decisions.
For example, I'm rendering a table and one column displays a DateTime? property that needs to be formatted. Because the value is nullable I need to check that it's not null before formatting.
If I wanted to be pedantic, I would have a FormattedDate property on my ViewModel:
public class MyViewModel
{
...
public DateTime? Date { get; set; }
public string FormattedDate
{
get
{
return this.Date.HasValue ? this.Date.Value.ToShortDateString() : "";
}
}
}
<%= Html.Encode(Model.FormattedDate) %>
Or I could save myself a few lines of code and simply slap it in the view:
<%= Html.Encode(Model.Date.HasValue ? Model.Date.Value.ToShortDateString() : "")%>
In this case, since this is something that only affects the view, I would argue that it's OK to do it the second way (and also it's more compact) but where do I draw the line between having my view cluttered with server-side code and having my ViewModel cluttered with "formatting" properties?