Answer the question
In order to leave comments, you need to log in
How to speed up a request in a controller?
There is such a controller
[HttpGet("StockOnHand")]
public IActionResult GetStockOnHand()
{
var storeList = context.Stores
.Where(x => x.GeomarketName.StartsWith("RCA"))
.Where(x => x.SubSubSegmentName.StartsWith("WS"))
.Where(x => x.SegmentId == "WSV");
var tempList = storeList.Select(x => x.StoreId);
var StockList = context.StockOnHands
.Where(x => x.PartType.Contains("Inventory"))
.Where(x => tempList.Contains(x.StoreId))
.ToList();
var stockItems = StockList
.Select(x =>
{
Store store = storeList
.Where(s => s.StoreId == x.StoreId)
.FirstOrDefault();
return new StockOnHandList()
{
StockId = x.StockId,
Store = new StoreListDto(store),
StoreId = x.StoreId,
PartNumber = x.PartNumber,
PartDescription = x.PartDescription,
LastPurchasePrice = x.LastPurchasePrice,
StockOnHandQuantity = x.StockOnHandQuantity,
U = x.U,
LotNumber = x.LotNumber,
ExpirationDate = x.ExpirationDate,
ReportUpdateDate = x.ReportUpdateDate,
};
})
.ToList();
return Json(stockItems);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question