public IEnumerable <Shipping_RecordsViewModel> ReadD(decimal ParametroFedex) { var total = from Shipping_Records in BD.Shipping_Records where Shipping_Records.RecordFedexTracking == ParametroFedex join products in BD.Shipping_Catalog_Products on Shipping_Records.ProductID equals products.ProductID group Shipping_Records by new { products.ProductName, Shipping_Records.RecordPieceBoxNo } into Shipping_RecordsGroup select new Shipping_RecordsViewModel() { ProductName = Shipping_RecordsGroup.Key.ProductName, RecordPieceBoxNo = Shipping_RecordsGroup.Key.RecordPieceBoxNo, RecordCantidad = Shipping_RecordsGroup.Sum(x => x.RecordQuantity) }; return(total); }
public IEnumerable <Shipping_RecordsViewModel> ReadHotShot(DateTime starDate, DateTime endDate) { var suma = from Shipping_Records in BD.Shipping_Records where Shipping_Records.RecordDate >= starDate && Shipping_Records.RecordDate <= endDate join products in BD.Shipping_Catalog_Products on Shipping_Records.ProductID equals products.ProductID join clients in BD.Clients on Shipping_Records.ClientID equals clients.ClientID group Shipping_Records by new { products.ProductName, clients.ClientName, clients.ClientCompany, Shipping_Records.RecordFedexTracking, products.ProductType, Shipping_Records.RecordServiceType, Shipping_Records.RecordSerialNo, } into Shipping_RecordsGroup select new Shipping_RecordsViewModel() { Clients = new ClientesViewModel() { ClientName = Shipping_RecordsGroup.Key.ClientName, ClientCompany = Shipping_RecordsGroup.Key.ClientCompany }, Shipping_Catalog_Products = new Shipping_Catalog_ProductsViewModel() { ProductName = Shipping_RecordsGroup.Key.ProductName, ProductType = Shipping_RecordsGroup.Key.ProductType }, RecordFedexTracking = Shipping_RecordsGroup.Key.RecordFedexTracking, RecordSerialNo = Shipping_RecordsGroup.Key.RecordSerialNo, RecordServiceType = Shipping_RecordsGroup.Key.RecordServiceType, RecordQuantity = Shipping_RecordsGroup.Sum(a => a.RecordQuantity) }; return(suma); }