Example #1
0
        public async Task <bool> DeleteByIdAsync(string id)
        {
            if (id == null)
            {
                return(false);
            }
            var rate = await repository.GetByIdAsync(id);

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

            return(result > 0);
        }
Example #2
0
        public async Task <bool> AddViewAsync(string videoId)
        {
            if (videoId == null)
            {
                return(false);
            }
            var video = await videoRepository.GetByIdAsync(videoId);

            if (video == null)
            {
                return(false);
            }
            video.Views = ++video.Views;
            videoRepository.Update(video);
            await videoRepository.SaveChangesAsync();

            return(true);
        }