public async Task <IEnumerable <CustomOrderItem> > GetAllActiveItems(CustomOrderItemPrameters parameters) { if (parameters.SalesmanId == 0 && parameters.ProductionManagerId == 0 && parameters.WarehousemanId == 0) { return(await FindByCondition(i => ((i.Status == CustomOrderItemStatus.InProduction) && i.Order.Status == OrderStatus.InRealization && i.CustomProduct.Status == CustomProductStatus.Prepared)) .Include(i => i.CustomProduct) .ThenInclude(i => i.Technologist) .Include(i => i.CustomProduct) .ThenInclude(i => i.FileList) .ToListAsync()); } else { return(await FindByCondition(i => (i.Status == CustomOrderItemStatus.InProduction) && (i.Order.Status == OrderStatus.InRealization && i.CustomProduct.Status == CustomProductStatus.Prepared) && ((i.ProductionManagerId.Equals(parameters.ProductionManagerId)) || (i.Order.WarehousemanId.Equals(parameters.WarehousemanId)) || (i.Order.SalesmanId.Equals(parameters.SalesmanId)))) .Include(i => i.CustomProduct) .ThenInclude(i => i.Technologist) .Include(i => i.CustomProduct) .ThenInclude(i => i.FileList) .ToListAsync()); } }
public async Task <IActionResult> GetAllCustomOrderItemsFromOrdersHistory([FromQuery] CustomOrderItemPrameters parameters) { var items = await _repository.CustomOrderItem.GetAllItemsFromOrdersHistory(parameters); if (!items.Any()) { return(NoContent()); } _logger.LogInformation($"Returned custom order items history"); var itemsResult = _mapper.Map <IEnumerable <CustomOrderItemReadDto> >(items); return(Ok(itemsResult)); }