コード例 #1
0
 /// <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
     });
 }
コード例 #2
0
 /// <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
     });
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 /// <summary>
 /// Updates the response
 /// </summary>
 /// <param name="entity">Answer</param>
 public void Update(BllAnswer entity)
 {
     answerRepository.Update(entity.ToDalAnswer());
     unitOfWork.Commit();
 }