public ActionResult Edit(int id) { SetupEmployeeShiftMasterProviders EmShiftPro = new SetupEmployeeShiftMasterProviders(); SetupEmployeeShiftMasterModel model = new SetupEmployeeShiftMasterModel(); model = EmShiftPro.GetList().Where(x => x.EmployeeShiftMasterId == id).FirstOrDefault(); return(View(model)); }
// // GET: /SetupEmployeeShiftMaster/ //public ActionResult Index() //{ // return View(); //} public ActionResult Index() { SetupEmployeeShiftMasterProviders EmShiftPro = new SetupEmployeeShiftMasterProviders(); SetupEmployeeShiftMasterModel model = new SetupEmployeeShiftMasterModel(); model.SetupEmployeeShiftMasterModelList = EmShiftPro.GetList(); return(View(model)); }
public int Insert(SetupEmployeeShiftMasterModel model) { int i = 0; using (EHMSEntities ent = new EHMSEntities()) { var objToSave = AutoMapper.Mapper.Map <SetupEmployeeShiftMasterModel, SetupEmployeeShiftMaster>(model); objToSave.CreatedBy = 1; objToSave.CreatedDate = DateTime.Today; objToSave.Status = true; ent.SetupEmployeeShiftMasters.Add(objToSave); i = ent.SaveChanges(); } return(i); }
public int Update(SetupEmployeeShiftMasterModel model) { int i = 0; using (EHMSEntities ent = new EHMSEntities()) { var objToEdit = ent.SetupEmployeeShiftMasters.Where(x => x.EmployeeShiftMasterId == model.EmployeeShiftMasterId).FirstOrDefault(); AutoMapper.Mapper.Map(model, objToEdit); objToEdit.CreatedBy = 1; objToEdit.Status = true; objToEdit.CreatedDate = DateTime.Today; ent.Entry(objToEdit).State = System.Data.EntityState.Modified; i = ent.SaveChanges(); } return(i); }
public ActionResult Edit(int id, SetupEmployeeShiftMasterModel model) { if (ModelState.IsValid) { SetupEmployeeShiftMasterProviders EmShiftPro = new SetupEmployeeShiftMasterProviders(); int i = EmShiftPro.Update(model); if (i != null) { TempData["success"] = HospitalManagementSystem.UtilityMessage.edit; return(RedirectToAction("Index")); } else { TempData["success"] = HospitalManagementSystem.UtilityMessage.editfailed; return(RedirectToAction("Index")); } //return View(model); } return(View(model)); }
public ActionResult Create(SetupEmployeeShiftMasterModel model) { SetupEmployeeShiftMasterProviders EmShiftPro = new SetupEmployeeShiftMasterProviders(); if (ModelState.IsValid) { int i = EmShiftPro.Insert(model); if (i != null) { TempData["success"] = HospitalManagementSystem.UtilityMessage.save; return(RedirectToAction("Index")); } else { TempData["success"] = HospitalManagementSystem.UtilityMessage.savefailed; return(RedirectToAction("Index")); } } return(View()); }
public ActionResult Create() { SetupEmployeeShiftMasterModel model = new SetupEmployeeShiftMasterModel(); return(View(model)); }