public async Task UpsertReview(Review review)
        {
            var existingReview = await _database.Single <Review>(x => x.UserId == review.UserId && x.RestaurantId == review.RestaurantId);

            if (existingReview != null)
            {
                await _database.Delete <Review>(x => x.Id == review.Id);
            }
            await _database.Add(review);
        }
        public async Task <User> Login(string email, string password)
        {
            var user = await _database.Single <User>(x => x.Email.Equals(email));

            if (user == null)
            {
                return(null);
            }
            return(!VerifyPasswordHash(password, user.Password, user.PasswordSalt) ? null : user);
        }
        public async Task UpdateStock(List <Item> orderItems)
        {
            var restaurant = await _database.Single <Restaurant>(x
                                                                 => x.Menu.Any(m => m.Id == orderItems.FirstOrDefault().FoodId));

            foreach (var item in orderItems)
            {
                restaurant.Menu.FirstOrDefault(x => x.Id == item.FoodId).Quantity -= item.Quantity;
            }

            await _database.Delete <Restaurant>(x => x.Id == restaurant.Id);

            await _database.Add(restaurant);
        }
 public async Task <Order> GetOrder(Guid orderId)
 => (await _database.Single <Order>(x => x.Id == orderId));