public ActionResult Edit([Bind(Include = "TrainerId,FirstName,LastName,Salary,PhoneNumber,Email,PhotoUrl")] Trainer trainer, IEnumerable <int> SelectedCoursesId) { if (ModelState.IsValid) { repos.Update(trainer, SelectedCoursesId); return(RedirectToAction("Index")); } return(View(trainer)); }
public ActionResult Edit([Bind(Include = "TrainerId,FirstName,LastName,Subject")] Trainer trainer, IEnumerable <int> SelectedCoursesId) { if (ModelState.IsValid) { trainerRepository.Update(trainer, SelectedCoursesId); return(RedirectToAction("TrainerInfo")); } return(View(trainer)); }
public ActionResult Edit([Bind(Include = "TrainerId,FirstName,LastName,DateOfBirth,Salary,PhotoUrl,Telephone,Email,Country")] Trainer trainer, IEnumerable <int> selectedCourseId) { if (ModelState.IsValid) { trainerRepository.Update(trainer, selectedCourseId); return(RedirectToAction("TrainerTable")); } return(View(trainer)); }
public IActionResult UpdateTrainer(UpdateTrainerCommand updatedTrainerCommand, int id) { var repo = new TrainerRepository(); var updatedTrainer = new Trainer { Name = updatedTrainerCommand.Name, YearsOfExperience = updatedTrainerCommand.YearsOfExperience, Specialty = updatedTrainerCommand.Specialty, }; var trainer = repo.Update(updatedTrainer, id); return(Ok(trainer)); }
public IActionResult UpdateTrainer(UpdateTrainerCommand updatedTrainerCommand, Guid id) { //mapping/transforming var repo = new TrainerRepository(); var updatedTrainer = new Trainer { Name = updatedTrainerCommand.Name, YearsOfExp = updatedTrainerCommand.YearsOfExp, Specialty = updatedTrainerCommand.Specialty, }; var trainerThatGotUpdated = repo.Update(updatedTrainer, id); return(Ok(trainerThatGotUpdated)); }
public IActionResult UpdateTrainer(UpdateTrainerCommand updatedTrainerCommand, int id) { var updatedTrainer = new Trainer { Name = updatedTrainerCommand.Name, YearsOfExperience = updatedTrainerCommand.YearsOfExperience, Specialty = updatedTrainerCommand.Specialty }; var trainerThatGotUpdated = _repo.Update(updatedTrainer, id); if (trainerThatGotUpdated == null) { return(NotFound("Could not update trainer")); } return(Ok(trainerThatGotUpdated)); }
public IActionResult UpdateTrainer(UpdateTrainerCommand updatedTrainerCommand, int id) { var repo = new TrainerRepository(); var updatedTrainer = new Trainer { Name = updatedTrainerCommand.Name, YearOfExperience = updatedTrainerCommand.YearOfExperience, Specialty = updatedTrainerCommand.Specialty, }; var updatedRepoTrainer = repo.Update(updatedTrainer, id); if (updatedRepoTrainer == null) { return(NotFound("Could not update trainer")); } return(Ok(updatedRepoTrainer)); }
public static void UpdateTrainer(Trainer t) { TrainerRepository trainerRepository = new TrainerRepository(); trainerRepository.Update(t); }
public bool Update(Trainer trainer) { bool isSaved = _trainerRepository.Update(trainer); return(isSaved); }