public async Task <IActionResult> GetOrders(int customerId) { if (customerId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var orders = await _repo.GetOrders(); var ordersToReturn = _mapper.Map <IEnumerable <OrderReturnDTO> >(orders); return(Ok(ordersToReturn)); }