Пример #1
0
        public async Task <bool> RemoveReview(ObjectId id)
        {
            Review review = await Collection.GetAsync(id);

            bool rtn = await Collection.RemoveAsync(id);

            if (rtn)
            {
                UpdateRating(review.BeerId);
            }
            return(rtn);
        }
Пример #2
0
        public async Task <bool> RemoveBeer(ObjectId id)
        {
            bool bResp = await Collection.RemoveAsync(id);

            if (bResp)
            {
                List <Review> reviews = await ReviewCollection.GetListAsync(r => r.BeerId == id.ToString());

                foreach (Review review in reviews)
                {
                    _ = ReviewCollection.RemoveAsync(review.Id);
                }
            }
            return(bResp);
        }