コード例 #1
0
        public async Task <IEnumerable <ProjectDTO> > GetMostRecentAsync()
        {
            var currentUser = await GetCurrentUserAsync();

            var projects = _context.Projects.Where(x => !x.Archived && x.OwnerId == currentUser.Id).OrderByDescending(x => x.LastModified).Take(10);

            try
            {
                await EnsureAuthorizedAccessAsync(projects);
            }
            catch (Exception)
            {
                return(null);
            }

            return(ProjectDTO.DbSetToDtoList(projects));
        }
コード例 #2
0
        public async Task <IEnumerable <ProjectDTO> > GetProjectsAsync()
        {
            //return _context.Projects.Include(x=>x.LongTermGoals).Include(x=>x.Links);
            var currentUser = await GetCurrentUserAsync();

            var projects = _context.Projects.Where(x => x.OwnerId == currentUser.Id);

            try
            {
                await EnsureAuthorizedAccessAsync(projects);
            }
            catch (Exception)
            {
                return(null);
            }

            return(ProjectDTO.DbSetToDtoList(projects));
        }