예제 #1
0
 public object Get(int id) =>
 _ctx.Submissions
 .Where(x => x.Id.Equals(id))
 .Include(x => x.Video)
 .Include(x => x.User)
 .Select(SubmissionViewModels.PerspectiveProjection(UserId))
 .FirstOrDefault();
 public IEnumerable <object> GetAllSubmissionsForTechnique(string techniqueId, [FromQuery] FeedQuery feedQuery)
 {
     return(_context.Submissions
            .Include(s => s.Video)
            .Include(s => s.User)
            .Where(s => s.TechniqueId.Equals(techniqueId, StringComparison.InvariantCultureIgnoreCase))
            .OrderFeed(feedQuery)
            .Select(SubmissionViewModels.PerspectiveProjection(UserId))
            .ToList());
 }
 public IEnumerable <object> ListSubmissionsForTrick(string trickId, [FromQuery] FeedQuery feedQuery)
 {
     return(_ctx.Submissions
            .Include(x => x.Video)
            .Include(x => x.User)
            .Where(x => x.TrickId.Equals(trickId, StringComparison.InvariantCultureIgnoreCase))
            .OrderFeed(feedQuery)
            .Select(SubmissionViewModels.PerspectiveProjection(UserId))
            .ToList());
 }
예제 #4
0
 public IEnumerable <object> ListSubmissionsForTrick(string trickId, [FromQuery] FeedQuery feedQuery)
 {
     return(_ctx.Submissions
            .Include(x => x.Video)
            .Include(x => x.User)
            .Where(x => x.TrickId.ToLower() == trickId.ToLower())
            .OrderFeed(feedQuery)
            .Select(SubmissionViewModels.PerspectiveProjection(UserId))
            .ToList());
 }
예제 #5
0
        public object ListSubmissionsForTrick(string byTricks)
        {
            var trickIds = byTricks.Split(';');

            return(_ctx.Submissions
                   .Where(x => trickIds.Contains(x.TrickId))
                   .Include(x => x.Video)
                   .Include(x => x.User)
                   .OrderByDescending(x => x.Votes.Sum(v => v.Value))
                   .Select(SubmissionViewModels.PerspectiveProjection(UserId))
                   .FirstOrDefault());
        }
        public object GetBestSubmissionForTechnique(string byTechniques)
        {
            var techniqueIds = byTechniques.Split(';');

            return(_context.Submissions
                   .Include(s => s.Video)
                   .Include(s => s.User)
                   .Where(s => techniqueIds.Contains(s.TechniqueId))
                   .OrderByDescending(s => s.Votes.Sum(v => v.Value))
                   .Select(SubmissionViewModels.PerspectiveProjection(UserId))
                   .FirstOrDefault());
        }
 public object GetSubmission(int id) => _context.Submissions
 .Where(s => s.Id.Equals(id))
 .Include(s => s.Video)
 .Include(s => s.User)
 .Select(SubmissionViewModels.PerspectiveProjection(UserId))
 .FirstOrDefault();