public IActionResult MeritListDetail(int MeritListID) { //MeritList ML = OurdbContext.MeritList.Where(abc => abc.MeritListId == MeritListID).FirstOrDefault(); MeritList ML = OurdbContext.MeritList.Find(MeritListID); return(View(ML)); }
private MeritList CopyMLToMML(MeritList ML) { ModelMeritList MML = new ModelMeritList { MeritListId = ML.MeritListId, FkProgramId = ML.FkProgramId, Shift = ML.Shift, MeritListValue = ML.MeritListValue, DateCreated = ML.DateCreated, DateUpdated = ML.DateUpdated, }; return(ML); }
public IActionResult UpdateMeritList(int id) { if (id < 1) { return(NotFound()); } MeritList ML = OurdbContext.MeritList.Find(id); if (ML.MeritListId < 1) { return(NotFound()); } IList <Program> ILP = OurdbContext.Program.ToList(); ViewBag.vb = ILP; IList <Shift> ILS = OurdbContext.Shift.ToList(); ViewBag.vbs = ILS; return(View("AddUpdateMeritList", CopyMLToMML(ML))); }
//public IActionResult MeritListDelete(int MeritListID) //{ // MeritList ML = OurdbContext.MeritList.Find(MeritListID); // OurdbContext.MeritList.Remove(ML); // OurdbContext.SaveChanges(); // return RedirectToAction(nameof(AdministratorController.MeritListList)); //} public bool DeleteMeritList(int Id) { try { MeritList ML = OurdbContext.MeritList.Find(Id); if (ML != null) { OurdbContext.MeritList.Remove(ML); OurdbContext.SaveChanges(); return(true); } else { return(false); } } catch { return(false); } }