public ActionResult Edit(TreatmentModelView model)
 {
     if (ModelState.IsValid)
     {
         _treat.UpdateT(model);
         return(RedirectToAction("GetAllT"));
     }
     return(View(model));
 }
 public ActionResult AddT(TreatmentModelView model)
 {
     if (ModelState.IsValid)
     {
         _treat.AddT(model);
         return(RedirectToAction("RatioManagement", "TreatmentRatioManagement"));
     }
     return(View(model));
 }
 public void AddT(TreatmentModelView model)
 {
     using (var treatment = new TreatmentRepository())
     {
         var treat = new Treatment
         {
             Tid   = model.Tid,
             Tname = model.Tname,
         };
         treatment.Insert(treat);
     }
 }
        public void UpdateT(TreatmentModelView model)
        {
            using (var treatment = new TreatmentRepository())
            {
                Treatment treat = treatment.GetById(model.Tid);
                if (treat != null)
                {
                    treat.Tid   = model.Tid;
                    treat.Tname = model.Tname;

                    treatment.Update(treat);
                }
            }
        }
 public TreatmentModelView GetTById(int id)
 {
     using (var treatment = new TreatmentRepository())
     {
         Treatment treat     = treatment.GetById(id);
         var       treatView = new TreatmentModelView();
         if (treat != null)
         {
             treatView.Tid   = treat.Tid;
             treatView.Tname = treat.Tname;
         }
         return(treatView);
     }
 }
        public ActionResult DetailsT(int id)
        {
            TreatmentModelView treat = _treat.GetTById(id);

            return(View(treat));
        }