Beispiel #1
0
        public DTOList <AgeGroupDTO> GetAgeGroups()
        {
            DTOList <AgeGroupDTO> retValue = null;

            using (var context = new DataAccessContext())
            {
                var ageGroups = (from n in context.AgeGroups
                                 select n).ToList();

                retValue = retValue.DTOConvert(ageGroups);
            }

            return(retValue);
        }
Beispiel #2
0
        public DTOList <SubLocationDTO> GetSubLocations()
        {
            DTOList <SubLocationDTO> retValue = null;

            using (var context = new DataAccessContext())
            {
                var subLocations = (from n in context.SubLocations
                                    select n).ToList();

                retValue = retValue.DTOConvert(subLocations);
            }

            return(retValue);
        }
Beispiel #3
0
        public DTOList <CategoryDTO> GetCategories()
        {
            DTOList <CategoryDTO> retValue = null;

            using (var context = new DataAccessContext())
            {
                var categories = (from n in context.Categories
                                  select n).ToList();

                retValue = retValue.DTOConvert(categories);
            }

            return(retValue);
        }
        public DTOList <ItemDTO> GetItemCheckouts()
        {
            DTOList <ItemDTO> retValue = null;

            using (var context = new DataAccessContext())
            {
                var list = (from n in context.Items
                            where n.CheckOutDate != null
                            select n).ToList();

                retValue = retValue.DTOConvert(list);
            }

            return(retValue);
        }
        public DTOList <UserDTO> GetUsers()
        {
            DTOList <UserDTO> retValue = null;


            using (var context = new DataAccessContext())
            {
                var list = (from n in context.Users
                            select n).ToList();

                retValue = retValue.DTOConvert(list);
            }

            return(retValue);
        }
        public DTOList <ItemDTO> GetItems()
        {
            DTOList <ItemDTO> retValue = null;

            using (var context = new DataAccessContext())
            {
                var items = (from i in context.Items
                             select i).ToList();

                retValue = retValue.DTOConvert(items);

                retValue.StatusMessage = $"Found {items.Count} items";
            }

            return(retValue);
        }
        public DTOList <ItemDTO> GetItems(ItemFilterDTO filter)
        {
            DTOList <ItemDTO> retValue = null;

            using (var context = new DataAccessContext())
            {
                var items = (from n in context.Items
                             where n.CategoryId == filter.CategoryId &&
                             n.AssociatedUserId == null                             // no one has it checked out or requested
                             select n).ToList();

                if (filter.AgeGroupId > 0)
                {
                    items = (from i in items
                             where i.Item2AgeGroup.Count(n => n.AgeGroupId == filter.AgeGroupId) > 0
                             select i).ToList();
                }

                if (filter.SubjectId > 0)
                {
                    items = (from i in items
                             where i.Item2Subject.Count(n => n.SubjectId == filter.SubjectId) > 0
                             select i).ToList();
                }

                if (filter.LocationId > 0)
                {
                    items = (from i in items
                             where i.LocationId == filter.LocationId
                             select i).ToList();
                }

                retValue = retValue.DTOConvert(items);

                retValue.StatusMessage = $"Found {items.Count} items";
            }

            return(retValue);
        }