public void Save(CallQuestionItem uiQuestion) { CallQuestion dbQuestion; if (uiQuestion.Id == 0) { dbQuestion = new CallQuestion(); Db.CallQuestions.Add(dbQuestion); } else { dbQuestion = Db.CallQuestions.Single(x => x.Id == uiQuestion.Id); } dbQuestion.Text = uiQuestion.Text; dbQuestion.CallScriptId = uiQuestion.CallScriptId; Db.SaveChanges(); uiQuestion.Id = dbQuestion.Id; }
public ActionResult EditQuestion([FromBody] CallQuestionItem item) { this.Service.CallQuestion.Save(item); return(Json(item)); }