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