public async Task <RedirectToRouteResult> UpdatingAuto(UpdateAutoDto auto) { if (!await RepositoryAuto.GetInstance(_context, _mapper).UpdateAutoDto(auto)) { return(RedirectToAction("UpdateAuto", new { @auto = auto, @error = true })); } return(RedirectToAction("GetListAuto")); }
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 async Task <ActionResult> UpdateAuto(int?id, UpdateAutoDto auto, bool error = false) { if (id == null) { if (auto == null) { return(RedirectToAction("GetListAuto", new { @error = true })); } else { ViewBag.error = error; return(View(auto)); } } else { UpdateAutoDto autoDto = await RepositoryAuto.GetInstance(_context, _mapper).GetAutoPerId(id.Value); return(View(autoDto)); } }