public ActionResult saveNewAlot(trefLeaveAllotment a) { db.trefLeaveAllotments.Add(a); db.SaveChanges(); return(Json(a, JsonRequestBehavior.AllowGet)); }
public ActionResult updateAlot(trefLeaveAllotment a) { db.Entry(a).State = System.Data.EntityState.Modified; db.SaveChanges(); return(Json(a, JsonRequestBehavior.AllowGet)); }
public ActionResult validateAlot(trefLeaveAllotment a) { var q = db.trefLeaveAllotments.Where(r => r.Id != a.Id && (r.LeaveCode == a.LeaveCode)); if (q.Count() > 0) { return(Json("error", JsonRequestBehavior.AllowGet)); } else { return(Json("ok", JsonRequestBehavior.AllowGet)); } }