public IActionResult Add(MedicineDemand meds)
        {
            // string s = meds.Medicine + meds.Demand.ToString();


            try
            {
                if (meds == null)
                {
                    return(RedirectToAction("Index", "DemandSupply"));
                }
                Demands newdemand = new Demands()
                {
                    Medicine = meds.Medicine,
                    Demand   = meds.Demand
                };
                int res = repo.AddDemand(newdemand);
                if (res > 0)
                {
                    return(RedirectToAction("AddSupply", newdemand));
                }
                return(RedirectToAction("Index", "DemandSupply"));
            }
            catch (Exception e)
            {
                ViewBag.Message = "Exception Encountered : " + e.Message;
                return(View("~/Views/Shared/ExceptionAndError.cshtml"));
            }
        }
Exemplo n.º 2
0
        public IActionResult Add(MedicineDemand meds)
        {
            // string s = meds.Medicine + meds.Demand.ToString();
            Demands newdemand = new Demands()
            {
                Medicine = meds.Medicine,
                Demand   = meds.Demand
            };
            int res = repo.AddDemand(newdemand);

            if (res > 0)
            {
                return(RedirectToAction("AddSupply", newdemand));
            }
            return(RedirectToAction("Index", "Home"));
        }