public ActionResult Details(int id) { ExaminationPrice priceList = DB.ExaminationPrices.Find(id); ViewBag.Title = "Price list"; return(View(priceList)); }
//Get public ActionResult Edit(int id) { ExaminationPrice priceList = DB.ExaminationPrices.Find(id); ViewBag.PaymentMethodID = new SelectList(DB.PaymentMethods, nameof(PaymentMethod.ID), nameof(PaymentMethod.Name), priceList.PaymentMethodID); ViewBag.ExaminationID = new SelectList(DB.Examinations, nameof(Examination.ID), nameof(Examination.Topic), priceList.ExaminationID); ViewBag.CurrencyID = new SelectList(DB.Currencies, nameof(Currency.ID), nameof(Currency.Name), priceList.CurrencyID); ViewBag.Title = "Edit Price list"; return(View(priceList)); }
public ActionResult Add(ExaminationPrice priceList) { int CreatorID = User.Identity.GetUserId <int>(); var Examination = DB.Examinations.Find(priceList.ExaminationID); priceList.CreationDate = DateTime.UtcNow; priceList.RevisionDate = DateTime.UtcNow; priceList.CreatorID = CreatorID; Examination.ExaminationPrices.Add(priceList); DB.SaveChanges(); return(RedirectToAction("Details", "Examinations", new { Examination.ID })); }
public ActionResult Edit(ExaminationPrice priceList) { int CreatorID = User.Identity.GetUserId <int>(); priceList.CreatorID = CreatorID; priceList.CreationDate = DateTime.UtcNow; priceList.RevisionDate = DateTime.UtcNow; if (ModelState.IsValid) { DB.Entry(priceList).State = EntityState.Modified; DB.SaveChanges(); return(RedirectToAction(nameof(Details), new { priceList.ID })); } ViewBag.PaymentMethodID = new SelectList(DB.PaymentMethods, nameof(PaymentMethod.ID), nameof(PaymentMethod.Name), priceList.PaymentMethodID); ViewBag.ExaminationID = new SelectList(DB.Examinations, nameof(Examination.ID), nameof(Examination.Topic), priceList.ExaminationID); ViewBag.CurrencyID = new SelectList(DB.Currencies, nameof(Currency.ID), nameof(Currency.Name), priceList.CurrencyID); ViewBag.Title = "Edit Price list"; return(View(priceList)); }