示例#1
0
        public RequestModelCollection getAllRequestsByUser(string username)
        {
            List <Request> all = context.Requests
                                 .Where(x => x.deleted != "Y" &&
                                        x.username == username
                                        ).ToList();

            if (all.Count == 0)
            {
                throw new ItemNotFoundException();
            }
            else
            {
                List <RequestModel> records = all.Select(x =>
                {
                    string status = x.current_status;
                    return(new RequestModel(x, x.Department, ItemGetter._getItemsForRequest(x, status)));
                }).ToList();

                return(new RequestModelCollection(records));
            }
        }
示例#2
0
        public RequestModelCollection getAllApprovedRequests()
        {
            List <Request> approved = context.Requests
                                      .Where(x => x.deleted != "Y" &&
                                             x.current_status == RequestStatus.APPROVED).ToList();

            if (approved.Count == 0)
            {
                throw new ItemNotFoundException();
            }
            else
            {
                List <RequestModel> records = approved.Select(x => new RequestModel(x, x.Department, ItemGetter._getItemsForRequest(x, RequestStatus.APPROVED))).ToList();

                return(new RequestModelCollection(records));
            }
        }