public PrescriptionViewModel(Prescription p)
        {
            IBL bl = new BLImplement();

            this.Id        = p.Id;
            this.medicine  = bl.getMedicine(p.medicine).Name;
            this.StartDate = p.StartDate;
            this.EndDate   = p.EndDate;
            this.Doctor    = bl.getDoctor(p.Doctor).Name;
            this.Patient   = bl.getPatient(p.Patient).Name;
            this.Cause     = p.Cause;
        }
Example #2
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         IBL      bl       = new BLImplement();
         Medicine medicine = bl.getMedicine(id);
         bl.deleteMedicine(medicine);
         ViewBag.Message = String.Format("The medicine {0} is successfully deleted", medicine.Name);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = String.Format(ex.Message);
         return(RedirectToAction("Index"));
     }
 }
Example #3
0
        // GET: Medicine/Details/5
        public ActionResult Details(int id)
        {
            if (id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IBL      bl       = new BLImplement();
            Medicine medicine = bl.getMedicine(id);

            if (medicine == null)
            {
                return(HttpNotFound());
            }
            var mvm = new MedicineViewModel(medicine);

            return(View(mvm));
        }