Beispiel #1
0
        public ActionResult Create(FaqViewModel model)
        {
            try
            {
                // TODO: Add insert logic here
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                var faq       = _mapper.Map <Faq>(model);
                var isSuccess = _repo.Create(faq);
                if (!isSuccess)
                {
                    ModelState.AddModelError("", "Something Went Wrong!");
                    return(View(model));
                }

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