Пример #1
0
        public async Task <RedirectToRouteResult> AddingAuto(CreateAutoDto auto)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("AddAuto", new { @auto = auto }));
            }

            if (await RepositoryAuto.GetInstance(_context, _mapper).CreateAutoDto(auto))
            {
                return(RedirectToAction("GetListAuto"));
            }
            else
            {
                return(RedirectToAction("AddAuto", new { @auto = auto, @error = true }));
            }
        }
Пример #2
0
        public ViewResult AddAuto(CreateAutoDto auto, bool error = false)
        {
            ViewBag.error = error;

            return(View(auto));
        }