public ActionResult Index() { SetUpIpdWardModel model = new SetUpIpdWardModel(); model.SetUpIpdWardModelList = Wardprovider.GetList(); return(View(model)); }
public ActionResult Edit(int id) { SetUpIpdWardModel model = new SetUpIpdWardModel(); model = Wardprovider.GetList().Where(x => x.IpdWardId == id).FirstOrDefault(); return(View(model)); }
public int Insert(SetUpIpdWardModel model) { using (EHMSEntities ent = new EHMSEntities()) { var objToSave = AutoMapper.Mapper.Map <SetUpIpdWardModel, SetupIpdWard>(model); ent.SetupIpdWards.Add(objToSave); ent.SaveChanges(); } return(1); }
public void Details(int id) { using (EHMSEntities ent = new EHMSEntities()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <SetupIpdWard, SetUpIpdWardModel>(); }); //AutoMapper.Mapper.CreateMap<SetupIpdWard, SetUpIpdWardModel>(); var Details = ent.SetupIpdWards.Where(x => x.IpdWardId == id).FirstOrDefault(); SetUpIpdWardModel det = AutoMapper.Mapper.Map <SetupIpdWard, SetUpIpdWardModel>(Details); } }
public int Update(SetUpIpdWardModel model) { using (EHMSEntities ent = new EHMSEntities()) { var objToEdit = ent.SetupIpdWards.Where(x => x.IpdWardId == model.IpdWardId).FirstOrDefault(); AutoMapper.Mapper.Map(model, objToEdit); ent.Entry(objToEdit).State = System.Data.EntityState.Modified; ent.SaveChanges(); } return(1); }
public ActionResult Edit(int id, SetUpIpdWardModel model) { if (ModelState.IsValid) { int i = Wardprovider.Update(model); if (i == 1) { TempData["success"] = "Record Updated Successfully !"; } else { TempData["success"] = "Record Updation Failed !"; } return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Create() { SetUpIpdWardModel model = new SetUpIpdWardModel(); return(View(model)); }