Esempio n. 1
0
        public ActionResult Add(MedicineModel model)
        {
            if (ModelState.IsValid)
            {
                var newId = model.Add();
                return(RedirectToAction("Details", new { id = newId }));
            }

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult Add(MedicineModel model)
        {
            if (ModelState.IsValid)
            {
                var newId = model.Add();
                return(RedirectToAction("AddSuccess"));
            }

            model.LoadAllListData();
            return(View(model));
        }
        public ActionResult Create(FormCollection collection)
        {
            //Check NDC
            var ndc = collection["NDC"];
            LicensedMedicineLogic NDCs = new LicensedMedicineLogic();

            if (NDCs.GetMedicineByNdc(ndc).Count() == 0) //there is no such NDC
            {
                ViewBag.message2           = "There is no such a medicine NDC!";
                ViewBag.CommercialName     = collection["CommercialName"];
                ViewBag.GenericName        = collection["GenericName"];
                ViewBag.Producer           = collection["Producer"];
                ViewBag.ActiveIngredients  = collection["ActiveIngredients"];
                ViewBag.DoseCharacteristic = collection["DoseCharacteristic"];
                return(View());
            }

            MedicineModel model = new MedicineModel();

            ViewBag.message1 = model.Add(collection["CommercialName"], collection["GenericName"], collection["Producer"], collection["ActiveIngredients"], collection["DoseCharacteristic"], collection["NDC"]);
            return(RedirectToAction("Catalog"));
        }