public ActionResult Details(int id) { SetupManpowerModel model = new SetupManpowerModel(); model = pro.GetlistOfMainpower().Where(x => x.ManpowerId == id).FirstOrDefault(); return(View(model)); }
public ActionResult Edit(int id) { EHMSEntities ent = new EHMSEntities(); SetupManpowerModel model = new SetupManpowerModel(); model = pro.GetlistOfMainpower().Where(x => x.ManpowerId == id).FirstOrDefault(); return(View(model)); }
public ActionResult Index() { SetupManpowerModel model = new SetupManpowerModel(); model.lstofSetupManpowerModel = pro.GetlistOfMainpower(); return(View(model)); }
public int Insert(SetupManpowerModel model) { int i = 0; var objToSave = AutoMapper.Mapper.Map <SetupManpowerModel, SetupManpower>(model); ent.SetupManpowers.Add(objToSave); i = ent.SaveChanges(); return(i); }
public int Update(SetupManpowerModel model) { int i = 0; EHMSEntities ent = new EHMSEntities(); var objToEdit = ent.SetupManpowers.Where(x => x.ManpowerId == model.ManpowerId).FirstOrDefault(); AutoMapper.Mapper.Map(model, objToEdit); // ent.Entry(objToEdit).State = System.Data.EntityState.Modified; ent.Entry(objToEdit).State = System.Data.EntityState.Modified; i = ent.SaveChanges(); return(i); }
public ActionResult Edit(SetupManpowerModel model) { int i = pro.Update(model); if (i != 0) { TempData["success"] = HospitalManagementSystem.UtilityMessage.edit; return(RedirectToAction("Index")); } else { TempData["success"] = HospitalManagementSystem.UtilityMessage.editfailed; return(RedirectToAction("Index")); } }
public ActionResult Create(SetupManpowerModel model) { SetupManpowerModel obj = new SetupManpowerModel(); int i = pro.Insert(model); if (i != 0) { TempData["success"] = HospitalManagementSystem.UtilityMessage.save; return(RedirectToAction("Index")); } else { TempData["success"] = HospitalManagementSystem.UtilityMessage.savefailed; return(RedirectToAction("Index")); } }