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 })); } }
public ViewResult AddAuto(CreateAutoDto auto, bool error = false) { ViewBag.error = error; return(View(auto)); }