Пример #1
0
        public ActionResult Create(Answer newAnswer, IFormCollection collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _answerRepo.AddAnswer(newAnswer);
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to create an answer: {ex}");
                return(View(newAnswer));
            }
        }