Example #1
0
        public void Save(CallAnswerItem uiAnswer)
        {
            CallAnswer dbAnswer;

            if (uiAnswer.Id == 0)
            {
                dbAnswer = new CallAnswer();
                Db.CallAnswers.Add(dbAnswer);
            }
            else
            {
                dbAnswer = Db.CallAnswers.Single(x => x.Id == uiAnswer.Id);
            }

            dbAnswer.Text           = uiAnswer.Text;
            dbAnswer.FromQuestionId = uiAnswer.FromQuestionId;
            dbAnswer.ToQuestionId   = uiAnswer.ToQuestionId;
            Db.SaveChanges();
            uiAnswer.Id = dbAnswer.Id;
        }
Example #2
0
 public ActionResult EditAnswer([FromBody] CallAnswerItem item)
 {
     this.Service.CallAnswer.Save(item);
     return(Json(item));
 }