Exemplo n.º 1
0
        public async Task <IActionResult> GetLastPurchaseForUser(int userId)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            PurchaseOrder <UserOffer> purchase = await _repo.GetLastPurchaseForUser(userId);

            var purchaseDto = _mapper.Map <PurchaseOrderDto>(purchase);

            return(Ok(purchaseDto));
        }