public ActionResult DeleteConfirmed(int id) { ServicesPrice servicesPrice = db.ServicesPrices.Find(id); db.ServicesPrices.Remove(servicesPrice); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,TariffId,ServiceId,Award,AwardUnit,DoctorFee,DoctorFeeUnit")] ServicesPrice servicesPrice) { if (ModelState.IsValid) { db.Entry(servicesPrice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ServiceId = new SelectList(db.Services, "Id", "ServiceName", servicesPrice.ServiceId); ViewBag.TariffId = new SelectList(db.Tariffs, "Id", "TariffName", servicesPrice.TariffId); return(View(servicesPrice)); }
// GET: ServicesPrices/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServicesPrice servicesPrice = db.ServicesPrices.Find(id); if (servicesPrice == null) { return(HttpNotFound()); } return(View(servicesPrice)); }
// GET: ServicesPrices/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServicesPrice servicesPrice = db.ServicesPrices.Find(id); if (servicesPrice == null) { return(HttpNotFound()); } ViewBag.ServiceId = new SelectList(db.Services, "Id", "ServiceName", servicesPrice.ServiceId); ViewBag.TariffId = new SelectList(db.Tariffs, "Id", "TariffName", servicesPrice.TariffId); return(View(servicesPrice)); }
public ActionResult Award100PercentToNHIF() { var x = 0; var nhif = db.Companies.FirstOrDefault(e => e.CompanyName.ToLower().Trim() == "nhif"); var services = db.Services.ToList(); if (nhif != null) { foreach (var t in nhif.Tariffs) { db.ServicesPrices.RemoveRange(t.ServicesPrices); db.SaveChanges(); foreach (var s in services) { var sp = new ServicesPrice(); sp.TariffId = t.Id; sp.ServiceId = s.Id; sp.Award = 100; sp.AwardUnit = "Percent"; sp.DoctorFee = 0; sp.DoctorFeeUnit = "Amount"; sp.DateAdded = DateTime.Now; sp.BranchId = (int)Session["UserBranchId"]; sp.UserId = (int)Session["UserId"]; db.ServicesPrices.Add(sp); x++; } db.SaveChanges(); } } return(Content("Updated " + x + " records")); }