private bool ValidateRequest(ContractRequest request) { var validRole = new[] { PersonRoleFunction.LicentieContactPersoon }.Any(r => r == request.Role); if (!validRole) { throw new Exception("Invalid role"); } return(validRole); }
//[SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(IEnumerable<ErrorResource>))] public HttpResponseMessage Get([FromBody] ContractRequest request) { try { ValidateRequest(request); var contracts = _contractRepository.GetContracts(request.Id, request.InstituteId, request.ContractStatuses, request.ContractTypes, request.DocumentTypes, request.Or); return(Request.CreateResponse(HttpStatusCode.OK, contracts)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }