Esempio n. 1
0
        public ActionResult SendMedicine(SendMedicine sendMedicine)
        {
            var districtList = headManager.GetDistrictList();

            ViewBag.DistrictList = new SelectList(districtList, "Id", "Name");

            var thanaList = headManager.GetThanaList();

            ViewBag.ThanaList = new SelectList(thanaList, "Id", "Name");

            var centerList = headManager.GetCenterList();

            ViewBag.CenterList = new SelectList(centerList, "Id", "Name");

            var medicineList = headManager.GetMedicineList();

            ViewBag.MedicineList = new SelectList(medicineList, "Id", "GenericName");

            List <SendMedicine> sendMedicines = (Session["SendMedicine"]) as List <SendMedicine>;

            ViewBag.SendMedicine = sendMedicines;

            if (!ModelState.IsValid)
            {
                return(View(sendMedicine));
            }

            sendMedicines.Add(sendMedicine);
            Session["SendMedicine"] = sendMedicines;

            foreach (SendMedicine medicine in sendMedicines)
            {
                medicine.MedicineName = headManager.GetMedicineNamebyId(medicine.MedicineId).GenericName;
            }

            ViewBag.SendMedicine = sendMedicines;
            ViewBag.Message      = "Medicine Added To the List";
            return(View(sendMedicine));
        }