示例#1
0
        public async Task <bool> UnbanByIdAsync(string id)
        {
            var user = await userRepository.AllWithDeleted()
                       .Include(u => u.Uploads)
                       .Include(u => u.Ratings)
                       .Include(u => u.Comments)
                       .SingleOrDefaultAsync(u => u.Id == id);

            if (user == null)
            {
                return(false);
            }
            foreach (var rate in user.Ratings)
            {
                await rateService.RestoreByIdAsync(rate.Id);
            }
            foreach (var comment in user.Comments)
            {
                await commentSerivce.RestoreByIdAsync(comment.Id);
            }
            foreach (var video in user.Uploads)
            {
                await videoService.RestoreByIdAsync(video.Id);
            }
            userRepository.Undelete(user);


            await userRepository.SaveChangesAsync();


            return(true);
        }
示例#2
0
        public async Task <bool> RestoreByIdAsync(string id)
        {
            var video = await videoRepository.AllWithDeleted()
                        .Include(v => v.Comments)
                        .Include(v => v.Ratings)
                        .SingleOrDefaultAsync(v => v.Id == id);

            if (video == null)
            {
                return(false);
            }
            foreach (var rate in video.Ratings)
            {
                await rateService.RestoreByIdAsync(rate.Id);
            }
            foreach (var comment in video.Comments)
            {
                await commentSerivce.RestoreByIdAsync(comment.Id);
            }

            videoRepository.Undelete(video);
            var result = await videoRepository.SaveChangesAsync();

            return(result > 0);
        }
示例#3
0
        public async Task <bool> RestoreByIdAsync(string id)
        {
            var comment = await repository.AllWithDeleted().SingleOrDefaultAsync(c => c.Id == id);

            if (comment == null)
            {
                return(false);
            }
            repository.Undelete(comment);
            var result = await repository.SaveChangesAsync();

            return(result > 0);
        }
示例#4
0
        // GET: Countries/Delete/5
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(this.NotFound());
            }

            var country = await countryRepository.AllWithDeleted()
                          .FirstOrDefaultAsync(m => m.Id == id);

            if (country == null)
            {
                return(this.NotFound());
            }

            return(this.View(country));
        }
示例#5
0
        public async Task <bool> RestoreByIdAsync(string id)
        {
            if (id == null)
            {
                return(false);
            }
            var rate = await repository.AllWithDeleted().SingleOrDefaultAsync(r => r.Id == id);

            if (rate == null)
            {
                return(false);
            }
            repository.Undelete(rate);
            var result = await repository.SaveChangesAsync();

            return(result > 0);
        }
示例#6
0
 public IEnumerable <Order> GetAllOrdersWithDeleted()
 {
     return(orderRepository.AllWithDeleted());
 }
示例#7
0
        public IEnumerable <ApplicationUser> GetAllWithDeleted()
        {
            var users = _usersRepository.AllWithDeleted();

            return(users);
        }