public JsonResult SaveAnswer(Questions_Answers data) { if (data.Key == 0) { return(Json(new { Message = "Failed", JsonRequestBehavior.AllowGet })); } Questions_Answers qn = db.Questions_Answers.Where(w => w.Key == data.Key).FirstOrDefault(); qn.Answer = data.Answer; db.SaveChanges(); return(Json(new { Message = "Success", JsonRequestBehavior.AllowGet })); }
public ActionResult QnA(Questions_Answers cnt) { Questions_Answers qna = new Questions_Answers(); qna.Name = cnt.Name; qna.Email = cnt.Email; qna.Question = cnt.Question; qna.Date = DateTime.Now; qna.Type = cnt.Type; db.Questions_Answers.Add(qna); db.SaveChanges(); return(Json(JsonRequestBehavior.AllowGet, "")); }
public JsonResult getQuestionData(int?id) { Questions_Answers qdata = db.Questions_Answers.Where(w => w.Key == id).FirstOrDefault(); return(Json(qdata, JsonRequestBehavior.AllowGet)); }