Ejemplo n.º 1
0
        public ActionResult GenericDrugMaster()
        {
            ViewBag.SideEffects      = db.GenericNameSideEffects.OrderBy(p => p.Description).ToList();
            ViewBag.Toxicities       = db.GenericNameToxicites.OrderBy(p => p.Description).ToList();
            ViewBag.Contraindication = db.GenericNameContraindication.OrderBy(p => p.Description).ToList();
            ViewBag.Allergies        = db.GenericNameAllergies.OrderBy(p => p.Description).ToList();

            GenericDrugName genericDrugName = new GenericDrugName();
            var             data            = db.GenericDrugName.OrderByDescending(p => p.Id).Take(10).ToList();

            return(View(data));
        }
        public JsonResult AddNewGenericDrug(string name)
        {
            GenericDrugName drugName = new GenericDrugName()
            {
                Name = name
            };

            if (ModelState.IsValid)
            {
                db.GenericDrugName.Add(drugName);
                db.SaveChanges();
                return(Json(""));
            }
            return(Json(""));
        }
        public ActionResult AddNewGenericDrug(string name)
        {
            //first trial of the repository pattern
            RepoProcurement <GenericDrugName> repoProcurement = new RepoProcurement <GenericDrugName>();

            GenericDrugName drugName = new GenericDrugName()
            {
                Name = name
            };

            if (ModelState.IsValid)
            {
                repoProcurement.Add(drugName);
                return(Json(""));
            }
            else
            {
                return(View());
            }
        }