public ActionResult AddQualificationTypesEnd(Def_QualificationTypes Def_QualificationTypes) { if (ModelState.IsValid) { try { db.Def_QualificationTypes.Add(Def_QualificationTypes); db.SaveChanges(); var l = JsonConvert.SerializeObject(db.Def_QualificationTypes.Select(a => new { ID = a.ID, Name = a.Name }).ToList()); return(Json(new { action = "yes", msg = "Added", QualificationTypesList = l }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { action = "no", msg = "error" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { action = "no", msg = "error" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditQualificationTypesEnd(Def_QualificationTypes Def_QualificationTypes) { if (ModelState.IsValid) { try { var ob = db.Def_QualificationTypes.Where(a => a.ID == Def_QualificationTypes.ID).FirstOrDefault(); ob.Name = Def_QualificationTypes.Name; db.SaveChanges(); var l = JsonConvert.SerializeObject(db.Def_QualificationTypes.Select(a => new { ID = a.ID, Name = a.Name }).ToList()); return(Json(new { action = "yes", msg = "Editted", QualificationTypesList = l }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { action = "no", msg = "error" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { action = "no", msg = "error" }, JsonRequestBehavior.AllowGet)); } }