public void AddTrainerAdds() { mTrainerData.TotalTrainers = 1; mTrainerData.AvailableTrainers = 1; mTrainerData.AddTrainer(TrainerManager.NORMAL_TRAINERS, 1); Assert.AreEqual(2, mTrainerData.AvailableTrainers); }
public async Task <ActionResult> Create(CreateOrUpdateTrainerRequest request) { try { await _manager.AddTrainer(request); return(RedirectToAction(nameof(ShowTrainers))); } catch (ArgumentNullException) { return(RedirectToAction("ErrorPage", nameof(Main), new { message = "Error: can not add new trainer", call = nameof(Trainer) })); } catch (DbUpdateException) { return(RedirectToAction("ErrorPage", nameof(Main), new { message = "Error: this employee alredy exists", call = nameof(Trainer) })); } }