Пример #1
0
        public async Task <ActionResult> UpdateTrainer(int id)
        {
            try {
                var entity = await _manager.GetTrainerById(id);

                var tmp = await _manager.CreateListForViewCreateTrainer();

                var tup = (entity, tmp);
                return(View(tup));
            }
            catch (ArgumentNullException) {
                return(RedirectToAction("ErrorPage", nameof(Main), new { message = "Error: can not find trainer with this id", call = nameof(Trainer) }));
            }
            catch (DbUpdateException) {
                return(RedirectToAction("ErrorPage", nameof(Main), new { message = "Error: invalid input", call = nameof(Trainer) }));
            }
        }