public ActionResult EditTrainer(TrainerViewModelInStaff model) { var findTrainer = _context.Users.OfType <Trainer>().SingleOrDefault(t => t.Id == model.Id); findTrainer.TrainerName = model.TrainerName; findTrainer.TypeId = model.TypeId; findTrainer.WorkingPlace = model.WorkingPlace; _context.SaveChanges(); return(RedirectToAction("AllTrainer")); }
public ActionResult EditTrainer(string Id) { var findTrainer = _context.Users.OfType <Trainer>().Include(t => t.Type).SingleOrDefault(t => t.Id == Id); if (findTrainer == null) { return(HttpNotFound()); } TrainerViewModelInStaff model = new TrainerViewModelInStaff() { Id = findTrainer.Id, TrainerName = findTrainer.TrainerName, Email = findTrainer.Email, WorkingPlace = findTrainer.WorkingPlace, Type = findTrainer.Type, Types = _context.Types.ToList() }; return(View(model)); }