public ActionResult EditEmpRewardsEnd(EmpRewards EmpReward) { if (ModelState.IsValid) { try { var ob = db.EmpRewards.Where(a => a.ID == EmpReward.ID).FirstOrDefault(); ob.Note = EmpReward.Note; ob.RewardID = EmpReward.RewardID; ob.Value = EmpReward.Value; ob.DaysNum = EmpReward.DaysNum; ob.DateAdded = EmpReward.DateAdded; db.SaveChanges(); return(Json(new { action = "yes", msg = "Edited" }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { action = "no", msg = "error occurred" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { action = "no", msg = "error occurred" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddEmpRewardsEnd(EmpRewards EmpRewards) { if (ModelState.IsValid) { try { db.EmpRewards.Add(EmpRewards); db.SaveChanges(); return(Json(new { action = "yes", msg = "Added" }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { action = "no", msg = "error occurred" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { action = "no", msg = "error occurred" }, JsonRequestBehavior.AllowGet)); } }