// GET: Prescriptions
        public ActionResult Index(int?id)
        {
            IBL bl            = new BlClass();
            var prescriptions = bl.GetPrescriptions(pre => pre.PatientId == id).Select(pr => new PrescriptionVM(pr));

            ViewBag.Patient = id;
            return(View(prescriptions));
        }
Exemplo n.º 2
0
        public ActionResult Chart(int?id)
        {
            List <int> list = new List <int>()
            {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            };

            IBL      bl       = new BlClass();
            Medicine medicine = bl.GetMedicine(id);

            ViewBag.ChartTitle = medicine.commercialName;

            IEnumerable <Prescription> prescriptions = bl.GetPrescriptions(pre => pre.startDate > new DateTime(2020, 01, 01));
            var prescriptionsForMedicine             = prescriptions.Where(pr => bl.GetMedicine(pr.MedicineId).commercialName == medicine.commercialName);

            foreach (var item in prescriptionsForMedicine)
            {
                list[item.startDate.Month - 1]++;
            }

            return(View(list));
        }
 public ActionResult Create(PrescriptionVM prescription)
 {
     try
     {
         if (ModelState.IsValid)
         {
             IBL bL = new BlClass();
             prescription.DoctorId = RouteConfig.doctor != null ? RouteConfig.doctor.Id : -1;
             bL.AddPrescription(prescription.Current);
             ViewBag.TitlePopUp = "עבר בהצלחה";
             ViewBag.Message    = "המרשם נוסף בהצלחה";
             var prescriptions = bL.GetPrescriptions(pre => pre.PatientId == prescription.PatientId).Select(pr => new PrescriptionVM(pr));
             ViewBag.Patient = prescription.PatientId;
             return(View("Index", prescriptions));
         }
         return(View(prescription));
     }
     catch (System.Exception ex)
     {
         ViewBag.TitlePopUp = "שגיאה";
         ViewBag.Message    = ex.Message;
         return(View(prescription));
     }
 }