protected IActionResult ResponseWithAllNotifications() { if (_domainNotification.HasNotifications()) { return(BadRequest(_domainNotification.Notify())); } return(Ok()); }
public IHttpActionResult Response(object result) { if (!_notifications.HasNotifications()) { try { _unitOfWork.Commit(); return(Ok(new { success = true, data = result })); } catch { // Logar o erro (Elmah) return(Content(HttpStatusCode.BadRequest, new { success = false, errors = new[] { "Ocorreu uma falha interna no servidor." } })); } } else { return(Content(HttpStatusCode.BadRequest, new { success = false, errors = _notifications.Notify().Select(n => n.Value) })); } }