Exemple #1
0
        public async Task <BaseResponse> Handle(query.GetEmployeeByFilterQuery request, CancellationToken cancellationToken)
        {
            try
            {
                var employees = await _provider.GetAllByQuery(request.IsBillable);

                if (employees == null || !employees.Any())
                {
                    return new BaseResponse
                           {
                               ResponseStatusCode = StatusCodes.Status404NotFound,
                               Value = "Records not available"
                           }
                }
                ;

                return(new BaseResponse
                {
                    ResponseStatusCode = StatusCodes.Status302Found,
                    Value = employees
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse
                {
                    ResponseStatusCode = StatusCodes.Status500InternalServerError,
                    Value = ex
                });
            }
        }