public ActionResult Index() { SetUpSectionModel model = new SetUpSectionModel(); model.SetUpSectionbModelList = SectionProvider.GetList(); return(View(model)); }
public ActionResult Edit(int id) { SetUpSectionModel model = new SetUpSectionModel(); model = SectionProvider.GetList().Where(x => x.SectionId == id).FirstOrDefault(); return(View(model)); }
public void Details(int id) { using (EHMSEntities ent = new EHMSEntities()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <SetupSection, SetUpSectionModel>(); }); //AutoMapper.Mapper.CreateMap<SetupSections, SetUpSectionModel>(); var Details = ent.SetupSections.Where(x => x.SectionId == id).FirstOrDefault(); SetUpSectionModel det = AutoMapper.Mapper.Map <SetupSection, SetUpSectionModel>(Details); } }
public int Update(SetUpSectionModel model) { using (EHMSEntities ent = new EHMSEntities()) { var objToEdit = ent.SetupSections.Where(x => x.SectionId == model.SectionId).FirstOrDefault(); AutoMapper.Mapper.Map(model, objToEdit); ent.Entry(objToEdit).State = System.Data.EntityState.Modified; ent.SaveChanges(); } return(1); }
public int Insert(SetUpSectionModel model) { using (EHMSEntities ent = new EHMSEntities()) { var objToSave = AutoMapper.Mapper.Map <SetUpSectionModel, SetupSection>(model); objToSave.CreatedBy = 1; objToSave.CreatedDate = DateTime.Now; objToSave.Status = 1; ent.SetupSections.Add(objToSave); ent.SaveChanges(); } return(1); }
public ActionResult Edit(int id, SetUpSectionModel model) { if (ModelState.IsValid) { int i = SectionProvider.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() { SetUpSectionModel model = new SetUpSectionModel(); return(View(model)); }