Ejemplo n.º 1
0
 public ServerResult <GiftCard> Get(int id)
 {
     Entities.GiftCard.GiftCard giftCard = _giftCardRepo.Get(id);
     return(new ServerResult <GiftCard>
     {
         Data = giftCard.ToDTO(),
         Success = true
     });
 }
Ejemplo n.º 2
0
        public bool OwnesGiftCard(ClaimsPrincipal user, int giftCardId,
                                  IGiftCardRepository _giftCards, ICustomerRepository _customers,
                                  IAuthRepository _auth)
        {
            var customerId   = _giftCards.Get(giftCardId).CustomerId;
            var restaurantId = _customers.Get(customerId).RestaurantId;

            if (this.GetUserEntity(user, _auth).RestaurantId == restaurantId)
            {
                return(true);
            }
            return(false);
        }