public async Task <OrdersModel> GetUserOrdersAsync(OrdersFilterModel model, long id) { var response = new OrdersModel(); if (id == 0) { response.Errors.Add(ErrorConstants.ModelIsNull); return(response); } var filterModel = FilterMapper.MapOrdersFilteringModel(model); var orders = await _orderRepository.GetByUserIdAsync(filterModel, id); if (orders == null) { response.Errors.Add(ErrorConstants.ImpossibleToFindOrder); return(response); } var responceOrders = new OrdersModel(); foreach (var order in orders.Data) { var orderItemModel = OrderMapper.MapResponseModelToModelItem(order); responceOrders.Items.Add(orderItemModel); } responceOrders.TotalCount = orders.TotalItemsCount; return(responceOrders); }