public async Task <IActionResult> Delete(int id) { try { await _vendedorService.RemoveAsync(id); return(RedirectToAction(nameof(Index))); } catch (Exception e) { throw new Exception(e.Message); } }
public async Task <IActionResult> Delete(int id) { try { await _vendedorSevice.RemoveAsync(id); // Removendo return(RedirectToAction(nameof(Index))); // Redirecionando para index. } catch (IntegrityException e) { return(RedirectToAction(nameof(Error), new { message = e.Message })); } }
public async Task <IActionResult> Excluir(int id) { try { await _vendedorService.RemoveAsync(id); return(RedirectToAction(nameof(Index))); } catch (IntegrityException e) { return(RedirectToAction(nameof(Error), new { message = e.Message })); } }
public async Task <IActionResult> Delete(int id) { try { await _vendedorService.RemoveAsync(id); // redirecionar para a pag inicial do crud : Index return(RedirectToAction(nameof(Index))); } catch (IntegrityException e) { return(RedirectToAction(nameof(Error), new { message = e.Message })); } }
public async Task <IActionResult> Delete(int id) { try { await _vendedorService.RemoveAsync(id); return(RedirectToAction(nameof(Index))); } catch (IntegrityException e) { return(RedirectToAction(nameof(Error), new { message = "Não foi possível excluir o vendedor pois há vendas relacioadas a esse registro." })); } }