Beispiel #1
0
        public ActionResult Edit(int id, CreateErrorMessageViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                var product = _mapper.Map <ErrorMessage>(model);

                var isSuccess = _repo.Update(product);

                if (!isSuccess)
                {
                    ModelState.AddModelError("", "Something Went Wrong");
                    return(View(model));
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ModelState.AddModelError("", "Something Went Wrong");
                return(View());
            }
        }