Exemplo n.º 1
0
        public void AddTrainerAdds()
        {
            mTrainerData.TotalTrainers     = 1;
            mTrainerData.AvailableTrainers = 1;

            mTrainerData.AddTrainer(TrainerManager.NORMAL_TRAINERS, 1);

            Assert.AreEqual(2, mTrainerData.AvailableTrainers);
        }
Exemplo n.º 2
0
        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) }));
            }
        }