public ActionResult Edit(int id) { ItemBlockSetupProvider IBSP = new ItemBlockSetupProvider(); ItemBlockSetupModel model = new ItemBlockSetupModel(); model = IBSP.GetList().Where(x => x.ItemBlcokSetupID == id).FirstOrDefault(); return(View(model)); }
// // GET: /ItemBlockSetup/ public ActionResult Index() { ItemBlockSetupProvider IBSP = new ItemBlockSetupProvider(); ItemBlockSetupModel model = new ItemBlockSetupModel(); model.ItemBlockSetupList = IBSP.GetList(); return(View(model)); }
public ActionResult Create(ItemBlockSetupModel model) { ItemBlockSetupProvider IBSP = new ItemBlockSetupProvider(); if (ModelState.IsValid) { EHMSEntities ent = new EHMSEntities(); int i = IBSP.Insert(model); } return(RedirectToAction("Index")); }
public int Insert(ItemBlockSetupModel model) { int i = 0; using (EHMSEntities ent = new EHMSEntities()) { var objToSave = AutoMapper.Mapper.Map <ItemBlockSetupModel, ItemBlockSetup>(model); objToSave.Status = true; objToSave.CreatedBy = 1; objToSave.CreatedDate = DateTime.Today; ent.ItemBlockSetups.Add(objToSave); i = ent.SaveChanges(); } return(i); }
public int Update(ItemBlockSetupModel model) { int i = 0; using (EHMSEntities ent = new EHMSEntities()) { var objToEdit = ent.ItemBlockSetups.Where(x => x.ItemBlockSetupID == model.ItemBlcokSetupID).FirstOrDefault(); AutoMapper.Mapper.Map(model, objToEdit); objToEdit.Status = true; objToEdit.CreatedBy = 1; objToEdit.CreatedDate = DateTime.Today; ent.Entry(objToEdit).State = System.Data.EntityState.Modified; i = ent.SaveChanges(); } return(i); }
public ActionResult Edit(int id, ItemBlockSetupModel model) { if (ModelState.IsValid) { ItemBlockSetupProvider IBSP = new ItemBlockSetupProvider(); int i = IBSP.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() { ItemBlockSetupModel model = new ItemBlockSetupModel(); return(View(model)); }