/// <summary> /// Maps BllAnswer entity to AnswerViewModel. /// </summary> /// <param name="answer"> BllAnswer instance.</param> /// <returns> AnswerViewModel instance.</returns> public static AnswerViewModel ToAnswerViewModel(this BllAnswer answer) { return(new AnswerViewModel { Id = answer.Id, QuestionId = answer.QuestionId, IsCorrect = answer.IsCorrect, AnswerText = answer.AnswerText }); }
/// <summary> /// Maps BllAnswer entity to DalAnswer entity. /// </summary> /// <param name="answer"> BllAnswer instance.</param> /// <returns> DalAnswer instance.</returns> public static DalAnswer ToDalAnswer(this BllAnswer answer) { return(new DalAnswer() { Id = answer.Id, QuestionId = answer.QuestionId, AnswerText = answer.AnswerText, IsCorrect = answer.IsCorrect }); }
public static AnswerViewModel ToMvcAnswer(this BllAnswer bllAnswer) { if (bllAnswer == null) { return(null); } var mvcAnswer = new AnswerViewModel() { Id = bllAnswer.Id, Text = bllAnswer.Text, IsRight = bllAnswer.IsRight, QuestionId = bllAnswer.QuestionId }; return(mvcAnswer); }
public static BllAnswer ToBllAnswer(this AnswerViewModel mvcAnswer) { if (mvcAnswer == null) { return(null); } var bllAnswer = new BllAnswer() { Id = mvcAnswer.Id, Text = mvcAnswer.Text, IsRight = mvcAnswer.IsRight, QuestionId = mvcAnswer.QuestionId }; return(bllAnswer); }
public static BllAnswer ToBllAnswer(this DalAnswer dalAnswer) { if (dalAnswer == null) { return(null); } var bllAnswer = new BllAnswer() { Id = dalAnswer.Id, Text = dalAnswer.Text, IsRight = dalAnswer.IsRight, QuestionId = dalAnswer.QuestionId }; return(bllAnswer); }
public static DalAnswer ToDalAnswer(this BllAnswer bllAnswer) { if (bllAnswer == null) { return(null); } var dalAnswer = new DalAnswer() { Id = bllAnswer.Id, Text = bllAnswer.Text, IsRight = bllAnswer.IsRight, QuestionId = bllAnswer.QuestionId }; return(dalAnswer); }
/// <summary> /// Updates the response /// </summary> /// <param name="entity">Answer</param> public void Update(BllAnswer entity) { answerRepository.Update(entity.ToDalAnswer()); unitOfWork.Commit(); }