public ActionResult Delete(String OnboardID) { int oid = Convert.ToInt32(OnboardID); Onboarder onboarder = db.Onboarders.FirstOrDefault(m => m.O_Id == oid); db.Onboarders.Remove(onboarder); db.SaveChanges(); return(View("Index")); }
public ActionResult Add(Onboarder onboarder) { if (onboarder.O_Name == null) { ViewBag.msg = "*Name is compulsory!!!"; return(View("Index")); } onboarder.O_Rotation_Num = 1; db.Onboarders.Add(onboarder); db.SaveChanges(); return(View("Index")); }
public ActionResult Update(String onboardId, String Onboard_Name, String ReportingManagerID) { if (Onboard_Name.Equals("")) { ViewBag.msg = "*Name is compulsory!!!"; return(View("Index")); } int oid = Convert.ToInt32(onboardId); Onboarder onboarder = db.Onboarders.FirstOrDefault(m => m.O_Id == oid); onboarder.RM_Id = Convert.ToInt32(ReportingManagerID); onboarder.O_Name = Onboard_Name; db.SaveChanges(); return(View("Index")); }
public ActionResult Onboarders_Create([DataSourceRequest] DataSourceRequest request, Onboarder onboarder) { if (ModelState.IsValid) { var entity = new Onboarder { O_Name = onboarder.O_Name, O_Rotation_Num = onboarder.O_Rotation_Num, RM_Id = onboarder.RM_Id }; db.Onboarders.Add(entity); db.SaveChanges(); onboarder.O_Id = entity.O_Id; } return(Json(new[] { onboarder }.ToDataSourceResult(request, ModelState))); }
public ActionResult Onboarders_Update([DataSourceRequest] DataSourceRequest request, Onboarder onboarder) { if (ModelState.IsValid) { var entity = new Onboarder { O_Id = onboarder.O_Id, O_Name = onboarder.O_Name, O_Rotation_Num = onboarder.O_Rotation_Num, RM_Id = onboarder.RM_Id }; db.Onboarders.Attach(entity); db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); } return(Json(new[] { onboarder }.ToDataSourceResult(request, ModelState))); }