Exemplo n.º 1
0
        public void SaveAnswer(Answer Answer)
        {
            IEnumerable <Answer> OldAnswer = from x in _context.Answers
                                             where x.AnswerId == Answer.AnswerId
                                             select x;

            if (OldAnswer.Any())
            {
                OldAnswer.First().AnswerContent = Answer.AnswerContent;
                OldAnswer.First().ChoiceId      = Answer.ChoiceId;
            }
            else
            {
                _context.Answers.Add(Answer);
            }

            _context.SaveChanges();
        }
Exemplo n.º 2
0
 public string Add(Plan plan)
 {
     try
     {
         plan.PlanId = Guid.NewGuid();
         _context.Plans.Add(plan);
         _context.SaveChanges();
         return("Succeeded");
     }
     catch (Exception ex)
     {
         return(ex.ToString());
     }
 }