Ejemplo n.º 1
0
        public IQueryable <Models.PartimInformation> GetPartims(int fileId, PartimMode partimMode)
        {
            var requestedPartims = _requestRepository.Table
                                   .Where(a => a.FileId == fileId)
                                   .SelectMany(a => a.RequestPartimInformations);

            switch (partimMode)
            {
            case PartimMode.Requested:
                return(requestedPartims.Where(x => x.PartimInformation.Module.Semester != 0).ProjectTo <Models.PartimInformation>());

            case PartimMode.Available:
                return
                    (_fileRepository.Table.Where(s => s.Id == fileId)
                     .Select(s => s.Education)
                     .SelectMany(e => e.Routes)
                     .SelectMany(r => r.PartimInformation)
                     .Except(requestedPartims.Select(x => x.PartimInformation))
                     .Where(x => x.Module.Semester != 0)
                     .ProjectTo <Models.PartimInformation>());

            default:
                throw new ArgumentOutOfRangeException(nameof(partimMode), partimMode, null);
            }
        }
Ejemplo n.º 2
0
        public IQueryable <PartimInformation> GetPartims(int fileId, PartimMode partimMode)
        {
            var partimInformation = new List <PartimInformation>
            {
                new PartimInformation
                {
                    Code       = "SDEV",
                    SuperCode  = "",
                    ModuleName = "Software ontwikkeling",
                    PartimName = "C#"
                }
            };

            return(partimInformation.AsQueryable());
        }