public async Task <IActionResult> Delete(long id) { try { await _empresaServicio.Eliminar(id); return(RedirectToAction(nameof(Index))); } catch (Exception) { return(RedirectToAction(nameof(Index))); } }
public async Task <IActionResult> DeleteEmpresa([FromRoute] long id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var empresa = _empresaServicio.ObtenerPorId(id); if (empresa == null) { return(NotFound()); } _empresaServicio.Eliminar(id); return(Ok(empresa)); }