public static ValuationScoreCardViewModel ToValuationScoreCardViewModel(this ValuationScoreCard scoreCard) { Requires.NotNull(scoreCard, "scoreCard"); return(new ValuationScoreCardViewModel { Id = scoreCard.JournalId, Remarks = scoreCard.Remarks, Submitted = scoreCard.Submitted, Editor = scoreCard.Editor, Journal = scoreCard.Journal.ToViewModel(), State = scoreCard.State, QuestionScores = scoreCard.QuestionScores.Select(ToViewModel).ToList() }); }
public void UpdateScoreCard(ValuationScoreCard scoreCard, TimeSpan scoreCardLifeTime) { foreach (var questionScore in scoreCard.QuestionScores) { questionScore.Score = this.QuestionScores.First(q => q.Id == questionScore.Id).Score; } scoreCard.Score = new ValuationScoreCardScore(scoreCard.QuestionScores); scoreCard.Remarks = this.Remarks; scoreCard.Submitted = this.Submitted; scoreCard.Editor = this.Editor; if (this.Publish) { scoreCard.State = ScoreCardState.Published; scoreCard.DatePublished = DateTime.Now; scoreCard.DateExpiration = DateTime.Now + scoreCardLifeTime; } }
private ValuationJournalPrice CreateNewValuationJournalPrice(ValuationScoreCard scoreCard) { return(new ValuationJournalPrice { ValuationScoreCardId = scoreCard.Id, JournalId = scoreCard.JournalId, UserProfileId = this.Authentication.CurrentUserId }); }