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

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

            model.LoadAllListData();
            return(View(model));
        }
Ejemplo n.º 3
0
        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"));
        }