示例#1
0
 public bool Edit(AnswerAdminViewModel model)
 {
     try
     {
         var actual = Mapper.Map<Answer>(model);
         this.Data.Answers.Update(actual);
         this.Data.SaveChanges();
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
示例#2
0
        public ActionResult Add(int questionId, string aDescription)
        {
            var newAnswer = new AnswerAdminViewModel
            {
                Description = aDescription,
                QuestionId = questionId
            };

            if (this.AnswersService.Create(newAnswer))
            {
                return this.AnswersList(questionId);
            }
            else
            {
                return null;
            }
        }