public async Task <ActionResult <JsonManagerResponse <IEnumerable <CartItemReadDto> > > > GetCartItems() { var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; if (User != null) { var cartItems = _CartRepo.getUserCart(userId); var list = _mapper.Map <IEnumerable <CartItemReadDto> >(cartItems); return(Ok(new JsonManagerResponse <IEnumerable <CartItemReadDto> > { IsSuccessful = true, ResponseObject = _mapper.Map <IEnumerable <CartItemReadDto> >(cartItems) })); } return(NotFound(new JsonManagerResponse <CartItemReadDto> { IsSuccessful = false, Message = "Process faild", ResponseObject = null })); }
public async Task <UserInfoDto> GetUserInfo(string userEmail) { var user = await _UserManager.FindByEmailAsync(userEmail); if (user != null) { var userInfoDto = _mapper.Map <UserInfoDto>(user); userInfoDto.UserCart = _CartRepo.getUserCart(user.Id).ToList(); return(userInfoDto); } return(null); }