public async Task <IActionResult> Edit(Banco model) { if (!ModelState.IsValid) { return(View(model)); } BancoResult result = await _service.Atualizar(model.Idbanco, model); if (result.Success == false) { ModelState.AddModelError(string.Empty, result.Message); return(View(model)); } TempDataUtil.Put(TempData, "mensagem", result.Message); return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(Banco model) { if (model == null) { return(View(model)); } BancoResult result = await _service.Excluir(model.Idbanco); if (result.Success == false) { ModelState.AddModelError(string.Empty, result.Message); return(View(model)); } TempDataUtil.Put(TempData, "mensagem", result.Message); return(RedirectToAction("Index")); }
public async Task <IActionResult> Create(Banco model) { if (!ModelState.IsValid) { return(View(model)); } BancoResult result = await _service.Gravar(model); if (result.Success == false) { ModelState.AddModelError(string.Empty, result.Message); return(View(model)); } TempDataUtil.Put(TempData, "model", result.Object); TempDataUtil.Put(TempData, "mensagem", result.Message); return(RedirectToAction("Details")); }