public IEnumerable <OrderDto> GetOrders(OrdersFilterAttributes attributes) { if (attributes == null) { return(UnitOfWork.Orders.GetAll().Select(o => o.ToDto()).ToList()); } _pipeline.Register(new OrdersByDateRangeFilter(attributes.From, attributes.To)); return(UnitOfWork.Orders.Find(_pipeline).Select(o => o.ToDto())); }
private IList <ShortOrderViewModel> GetOrders(DateTime from, DateTime to) { OrdersFilterAttributes attributes = new OrdersFilterAttributes { From = from, To = to }; IEnumerable <OrderDto> ordersDtos = _orderService.GetOrders(attributes); return(ordersDtos.Select(o => o.ToShortViewModel()).ToList()); }