Пример #1
0
        public ActionResult Details(int id)
        {
            ExaminationPrice priceList = DB.ExaminationPrices.Find(id);

            ViewBag.Title = "Price list";
            return(View(priceList));
        }
Пример #2
0
        //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));
        }
Пример #3
0
        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 }));
        }
Пример #4
0
        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));
        }