public ReponseResult Put([FromBody] DetailedOrganizationDTO organization) { ReponseResult result = new ReponseResult(); OperationResult operationResult = _business.UpdateOrganization(organization); result.Success = operationResult.Success; result.Message = operationResult.Message; return(result); }
private static async Task HandleExceptionAsync(HttpContext context, int statusCode, string msg) { var data = new ReponseResult { statusCode = statusCode, isError = false, message = msg }; var result = JsonSerializer.Serialize(data); context.Response.ContentType = "application/json;charset=utf-8"; await context.Response.WriteAsync(result).ConfigureAwait(true); }
public ReponseResult Get([FromQuery] OrganizationFilter filter) { ReponseResult result = new ReponseResult(); var organizations = _business.GetOrganizations(filter); result.Data = organizations; result.Success = true; return(result); }
public ReponseResult Post([FromBody] OrganizationDTO organization) { ReponseResult result = new ReponseResult(); OperationResult operationResult = _business.CreateOrganization(organization); result.Success = operationResult.Success; result.Message = operationResult.Message; if (result.Success) { result.Data = new { Id = operationResult.ObjectId }; } return(result); }