protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var gridData = context.DocTypes .Select(x => new DocumentTypesVM() { TypeName = x.Name, DocumentsCount = x.Documents.Count() }) .ToList(); LocationGV.DataSource = gridData; LocationGV.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var gridData = context.Warehouses .Include(x => x.Shelves) .Select(x => new LocationsVM() { WhName = x.Name, CurrentCap = context.Documents.Where(y => y.Box.Row.Shelf.WarehouseId == x.Id).Count(), MaxCap = x.Shelves.FirstOrDefault().Rows.FirstOrDefault().Boxes.FirstOrDefault().MaxCapacity * x.Shelves.FirstOrDefault().Rows.FirstOrDefault().MaxCapacity * x.Shelves.FirstOrDefault().MaxCapacity * x.MaxCapacity, }) .ToList(); LocationGV.DataSource = gridData; LocationGV.DataBind(); } }