public async Task <QueryResult <ProductionProcess> > FindAsync(ProductionProcessesQuery productionProcessesQuery) { var orderBy = String.Join(", ", productionProcessesQuery.OrderBys.ToList()); var productionProcesses = _context.ProductionProcesses.FromSqlRaw( "EXEC dbo.FindProductionProcesses {0}, {1}, {2}, {3}, {4}, {5}", productionProcessesQuery.Page, productionProcessesQuery.ItemsPerPage, orderBy, productionProcessesQuery.Name, String.Join(',', productionProcessesQuery.Products), String.Join(',', productionProcessesQuery.TechnologicalProcesses) ); var totalCount = CallStaticFunc <int>("TotalCountFindProductionProcesses", new List <SqlParameter>() { new SqlParameter("@name", productionProcessesQuery.Name), new SqlParameter("@products", String.Join(',', productionProcessesQuery.Products)), new SqlParameter("@technologicalProcesses", String.Join(',', productionProcessesQuery.TechnologicalProcesses)) }); return(new QueryResult <ProductionProcess>() { TotalItems = totalCount, Items = productionProcesses.ToList(), }); }
public async Task <QueryResult <ProductionProcess> > FindAsync(ProductionProcessesQuery query) { return(await _productionProcesses.FindAsync(query)); }