Exemple #1
0
        public ActionResult Editrate(int id)
        {
            var trainerrate = _context.Trainerrates.SingleOrDefault(m => m.Id == id);
            var trainer     = new Trainerrate()
            {
                Id        = trainerrate.Id,
                trainerid = trainerrate.trainerid,
                Duration  = trainerrate.Duration,
                Price     = trainerrate.Price
            };

            return(View(trainer));
        }
Exemple #2
0
        public ActionResult Editrate(Trainerrate tr)
        {
            if (ModelState.IsValid)
            {
                var trainerrates = _context.Trainerrates.Single(m => m.Id == tr.Id);
                trainerrates.Duration = Convert.ToInt32(tr.Duration);
                trainerrates.Price    = Convert.ToDecimal(tr.Price);
                _context.SaveChanges();
                return(RedirectToAction("Viewprices", "Trainer"));
            }


            return(View(tr));
        }
Exemple #3
0
 public ActionResult Trainerrate(Trainerrate tr)
 {
     if (ModelState.IsValid)
     {
         string trainerid = Session["UserId"].ToString();
         TempData["trainerid"] = trainerid;
         int tid = _context.Trainers.Single(m => m.userid == trainerid).TrainerId;
         TempData["tid"] = tid;
         Trainerrate trainerrate = new Trainerrate();
         trainerrate.trainerid = tid;
         trainerrate.Duration  = Convert.ToInt32(tr.Duration);
         trainerrate.Price     = Convert.ToDecimal(tr.Price);
         _context.Trainerrates.Add(trainerrate);
         _context.SaveChanges();
         return(RedirectToAction("Viewprices", "Trainer"));
     }
     return(View());
 }