Пример #1
0
        public ListLeavesResponse ListLeavesByEmployee(int maximumRows       = 10, int startRowIndex = 1,
                                                       string sortExpression = null, string employee = null, LeaveCategories?category = null,
                                                       LeaveStatuses?status  = null)
        {
            int totalRowCount = 0;
            var response      = new ListLeavesResponse();

            try
            {
                LeaveComponent bc = new LeaveComponent();
                response.Leaves = bc.ListLeavesByEmployee(maximumRows, startRowIndex, sortExpression,
                                                          employee, category, status, out totalRowCount);
                response.TotalRowCount = totalRowCount;
            }
            catch (Exception ex)
            {
                // Repack to Http error.
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422, // Unprocessable Entity
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }

            return(response);
        }
Пример #2
0
        //[Route("{action}/{maximumRows}/{startRowIndex}sortExpression={sortExpression}&employee={employee}&category={category=}&status={status=}")]
        public ListLeavesResponse ListLeavesByEmployee(int maximumRows, int startRowIndex,
                                                       string sortExpression, string employee, LeaveCategories?category,
                                                       LeaveStatuses?status)
        {
            int totalRowCount = 0;
            var response      = new ListLeavesResponse();

            LeaveComponent bc = new LeaveComponent();

            response.Leaves = bc.ListLeavesByEmployee(maximumRows, startRowIndex, sortExpression,
                                                      employee, category, status, out totalRowCount);
            response.TotalRowCount = totalRowCount;

            return(response);
        }