protected IActionResult ReturnData <T>(T objectData, ActionStatus status = ActionStatus.Ok, List <String> messages = null) { var objectReturn = new Model.ResponseModel <T>() { DataObject = objectData, Status = status.ToString(), Messages = messages ?? new List <string>() }; if (status == ActionStatus.Error) { return(this.NotFound(objectReturn)); } if (status == ActionStatus.ValidationError) { return(this.NotFound(objectReturn)); } if (status == ActionStatus.Warning) { return(this.NotFound(objectReturn)); } else { return(Ok(objectReturn)); } }
protected Model.ResponseModel <T> ResponseModel <T>(T objectData, ActionStatus status = ActionStatus.Ok, List <String> messages = null) { var objectReturn = new Model.ResponseModel <T>() { DataObject = objectData, Status = status.ToString(), Messages = messages ?? new List <string>() }; if (status == ActionStatus.Error) { this.Response.StatusCode = (int)HttpStatusCode.NotFound; } if (status == ActionStatus.ValidationError) { this.Response.StatusCode = (int)HttpStatusCode.NotFound; } if (status == ActionStatus.Warning) { this.Response.StatusCode = (int)HttpStatusCode.NotFound; } return(objectReturn); }