public ActionResult DeleteGradeParallel(int id) { using (LMSContext db = new LMSContext()) { GradeParallel grd = db.GradeParallels.Where(x => x.ID == id).FirstOrDefault <GradeParallel>(); db.GradeParallels.Remove(grd); db.SaveChanges(); return(Json(new { success = true, message = "Записът е изтрит." }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddOrEditGradeParallel(GradeParallel grd) { using (LMSContext db = new LMSContext()) { if (grd.ID == 0) { db.GradeParallels.Add(grd); db.SaveChanges(); return(Json(new { success = true, message = "Записът е успешен." }, JsonRequestBehavior.AllowGet)); } else { db.Entry(grd).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, message = "Редакцията е успешна." }, JsonRequestBehavior.AllowGet)); } } }