Exemplo n.º 1
0
 public async Task <IEnumerable <MovieRequests> > GetRequests()
 {
     return(await MovieRequestEngine.GetRequests());
 }
Exemplo n.º 2
0
        public async Task <bool> UnSubscribeToMovie(int requestId)
        {
            await MovieRequestEngine.UnSubscribeRequest(requestId, RequestType.Movie);

            return(true);
        }
Exemplo n.º 3
0
 public async Task <int> GetTotalMovies()
 {
     return(await MovieRequestEngine.GetTotal());
 }
Exemplo n.º 4
0
 public async Task <RequestEngineResult> MarkMovieUnAvailable([FromBody] MovieUpdateModel model)
 {
     return(await MovieRequestEngine.MarkUnavailable(model.Id));
 }
Exemplo n.º 5
0
 public async Task <RequestEngineResult> DenyMovie([FromBody] MovieUpdateModel model)
 {
     return(await MovieRequestEngine.DenyMovieById(model.Id));
 }
Exemplo n.º 6
0
 public async Task <MovieRequests> UpdateRequest([FromBody] MovieRequests model)
 {
     return(await MovieRequestEngine.UpdateMovieRequest(model));
 }
Exemplo n.º 7
0
        private async Task <UserViewModel> GetUserWithRoles(OmbiUser user)
        {
            var userRoles = await UserManager.GetRolesAsync(user);

            var vm = new UserViewModel
            {
                Alias               = user.Alias,
                UserName            = user.UserName,
                Id                  = user.Id,
                EmailAddress        = user.Email,
                UserType            = (Core.Models.UserType)(int) user.UserType,
                Claims              = new List <ClaimCheckboxes>(),
                LastLoggedIn        = user.LastLoggedIn,
                HasLoggedIn         = user.LastLoggedIn.HasValue,
                EpisodeRequestLimit = user.EpisodeRequestLimit ?? 0,
                MovieRequestLimit   = user.MovieRequestLimit ?? 0,
                MusicRequestLimit   = user.MusicRequestLimit ?? 0,
            };

            foreach (var role in userRoles)
            {
                vm.Claims.Add(new ClaimCheckboxes
                {
                    Value   = role,
                    Enabled = true
                });
            }

            // Add the missing claims
            var allRoles = await RoleManager.Roles.ToListAsync();

            var missing = allRoles.Select(x => x.Name).Except(userRoles);

            foreach (var role in missing)
            {
                vm.Claims.Add(new ClaimCheckboxes
                {
                    Value   = role,
                    Enabled = false
                });
            }

            if (vm.EpisodeRequestLimit > 0)
            {
                vm.EpisodeRequestQuota = await TvRequestEngine.GetRemainingRequests(user);
            }

            if (vm.MovieRequestLimit > 0)
            {
                vm.MovieRequestQuota = await MovieRequestEngine.GetRemainingRequests(user);
            }

            if (vm.MusicRequestLimit > 0)
            {
                vm.MusicRequestQuota = await MusicRequestEngine.GetRemainingRequests(user);
            }

            // Get the quality profiles
            vm.UserQualityProfiles = await _userQualityProfiles.GetAll().FirstOrDefaultAsync(x => x.UserId == user.Id);

            if (vm.UserQualityProfiles == null)
            {
                vm.UserQualityProfiles = new UserQualityProfiles
                {
                    UserId = user.Id
                };
            }

            return(vm);
        }
Exemplo n.º 8
0
 public async Task <IEnumerable <MovieRequests> > Search(string searchTerm)
 {
     return(await MovieRequestEngine.SearchMovieRequest(searchTerm));
 }
Exemplo n.º 9
0
 public async Task <RequestEngineResult> RequestMovie([FromBody] MovieRequestViewModel movie)
 {
     return(await MovieRequestEngine.RequestMovie(movie));
 }
Exemplo n.º 10
0
 public async Task DeleteRequest(int requestId)
 {
     await MovieRequestEngine.RemoveMovieRequest(requestId);
 }