I have code that looks like this:
itemView.Question.AnswersJSON = itemView.Answer.ToJSONString();
itemView.Question.Modified = DateTime.Now;
itemView.Question.Mo
Depending on how much control you have over the Question
class, separating the resposibility for setting that meta-data may be an idea:
class Question {
...
public void SetAnswer(Answer answer) {
this.AnswersJSON = answer.ToJSONString();
this.Modified = DateTime.Now;
this.Modified = User.Identity.Name; // or pass the user into SetAnswer()
}
}
// in your UI code:
itemView.Question.SetAnswer(itemView.Answer);