public IActionResult Delete(int pId) { try { var result = _service.Delete(pId); return(Json(_respuesta.RespuestaCorrectaPOST(result, "Se Elimino Correctamente", "Ocurrió un error"))); } catch (Exception ex) { return(Json(_respuesta.RespuestaError(ex.ToString()))); } }
public ServiceResponse <bool> Delete(int id) { var result = new ServiceResponse <bool>(); try { result.Result = result.Object = _service.Delete(id); if (!result.Result) { ((Notifiable)_service).Notifications .ToList() .ForEach(x => result.Messages.Add(x.Message)); } } catch (Exception ex) { result.Messages.Add("Problema ao Deletar o Usuário" + ex.Message); } return(result); }