public async Task <CinemaCreditCardGetDetailsRes> GetCreditCard(CinemaCreditCardGetDetailsReq req)
        {
            CinemaCreditCardGetDetailsRes res = await _dbContext.CinemaCreditCards
                                                .Where(c => c.UserId == req.UserId)
                                                .Select(c => new CinemaCreditCardGetDetailsRes
            {
                Id         = c.Id,
                CardNumber = c.CinemaCreditCardNumber,
                Balance    = c.Balance
            }).FirstOrDefaultAsync();

            return(res);
        }
Ejemplo n.º 2
0
        public async Task <UserGetDetailsRes> GetCurrentUser()
        {
            var          userId = _httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
            IdentityUser user   = await _dbContext.Users
                                  .Where(u => u.Id == userId)
                                  .FirstOrDefaultAsync();

            CinemaCreditCardGetDetailsReq req = new CinemaCreditCardGetDetailsReq
            {
                UserId = userId
            };

            CinemaCreditCardGetDetailsRes creditCard = await _cinemaCreditCardRepository.GetCreditCard(req);

            UserGetDetailsRes userDetails = new UserGetDetailsRes
            {
                User             = user,
                CinemaCreditCard = creditCard
            };

            return(userDetails);
        }