public ActionResult Create()
        {
            ViewBag.trainerList = ManagerTrainer.GetTrainers().ToList();
            ViewBag.planList    = ManagerPlan.Getplans().ToList();

            return(View());
        }
 public ActionResult Edit(string id)
 {
     if (string.IsNullOrEmpty(id))
     {
         return(RedirectToAction("Index", "Trainer", null));
     }
     return(View(ManagerTrainer.DetailTrainer(id)));
 }
        public ActionResult Edit(string id)
        {
            ViewBag.trainerList = ManagerTrainer.GetTrainers().ToList();
            ViewBag.planList    = ManagerPlan.Getplans().ToList();

            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("Index", "Customer", null));
            }
            return(View(ManagerCustomer.DetailCustomer(id)));
        }
        public ActionResult Details(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("Index", "Trainer", null));
            }
            TrainerEntity detail   = ManagerTrainer.DetailTrainer(id);
            string        filePath = "~/Uploads//trainer//";

            detail.trainer_photo = Path.Combine(filePath + detail.trainer_photo);

            return(View(detail));
        }
        public ActionResult SaveTrainer(TrainerEntity entity)
        {
            string fileName    = Path.GetFileNameWithoutExtension(entity.PhotoFile.FileName);
            string extension   = Path.GetExtension(entity.PhotoFile.FileName);
            string newFilename = Guid.NewGuid().ToString();

            newFilename = newFilename + extension;
            string filePath = "~/Uploads//trainer//";

            entity.trainer_photo = newFilename;
            filePath             = Server.MapPath(filePath + newFilename);
            entity.PhotoFile.SaveAs(filePath);
            ManagerTrainer.SaveTrainer(entity);
            return(RedirectToAction("Index", "Trainer", null));
        }
        public ActionResult DeleteTrainer(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("Index", "Trainer", null));
            }
            bool result = ManagerTrainer.DelTrainer(id);

            if (result == true)
            {
                return(RedirectToAction("Index", "Trainer", null));
            }
            else
            {
                return(Content("Error deleting Record,, Trainer found to training customer Please modify customer Record First"));
            }
        }
 public ActionResult Edit(TrainerEntity detail)
 {
     ManagerTrainer.EditTrainer(detail);
     return(RedirectToAction("Index", "Trainer", null));
 }
 // GET: Trainer
 public ActionResult Index()
 {
     return(View(ManagerTrainer.GetTrainers()));
 }