コード例 #1
0
        public ActionResult Save(pharmacy invoice)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new PharmacyFormViewModel
                {
                    Pharmacy = invoice
                };

                return(View("PharmacyForm", viewModel));
            }

            if (invoice._Id == Guid.Empty)
            {
                _context.InsertRecord(_table, invoice);
            }

            else
            {
                var invoiceInDb = _context.LoadRecordByIdProperity <pharmacy>(_table, invoice.Id);
                invoiceInDb.Patient = invoice.Patient;
                invoiceInDb.Notes   = invoice.Notes;
                invoiceInDb.Price   = invoice.Price;
                invoiceInDb.Drugs   = invoice.Drugs;

                _context.UPsertRecordByObjectId(_table, invoice._Id, invoice);
            }

            return(RedirectToAction("Index", "Pharmacy"));
        }
コード例 #2
0
        public ActionResult Index(string massage)
        {
            var viewModel = new PharmacyFormViewModel
            {
                Pharmacies = _context.Pharmacies.Where(p => p.IsApproved),
                Massage    = massage
            };

            return(View(User.IsInRole(UserRoles.CanApproveAndDeleteRecord) ? "PharmacyList" : "PharmacyListReadOnly", viewModel));
        }
コード例 #3
0
        public ActionResult New()
        {
            var drug = new pharmacy();

            drug.Id = GenerateUniqueID();

            var viewModel = new PharmacyFormViewModel
            {
                Pharmacy = drug
            };

            return(View("PharmacyForm", viewModel));
        }
コード例 #4
0
        public ActionResult Edit(string id)
        {
            var drug = _context.LoadRecordByIdProperity <pharmacy>(_table, id);

            if (drug == null)
            {
                return(HttpNotFound());
            }
            var viewModel = new PharmacyFormViewModel
            {
                Pharmacy = drug
            };

            return(View("PharmacyForm", viewModel));
        }