// GET: IngDataEntry public ActionResult Index() { StockCountViewModels model = new StockCountViewModels(); model.StoreId = CurrentUser.StoreId; return(View(model)); }
public ActionResult Search(StockCountViewModels model) { try { if (model.StoreId != null) { var data = _factory.GetData(model, listStoreId); if (data == null) { data = new List <StockCountModels>(); } var lastedItem = data.FirstOrDefault(); if (lastedItem != null) { if (!lastedItem.IsAutoCreated) { if (lastedItem.Status == (int)Commons.EStockCountStatus.Open) { lastedItem.IsVisible = true; } } } //var ListMax = data.GroupBy(x => new { x.StoreId }) // .Select(g => new StockCountModels() // { // StockCountDate = g.Max(x => x.StockCountDate), // Id = g.Select(x => x.Id).FirstOrDefault(), // IsAutoCreated = g.Select(x=>x.IsAutoCreated).FirstOrDefault() // }).ToList(); data.ForEach(x => { x.StoreName = lstStore.Where(z => z.Value.Equals(x.StoreId)).FirstOrDefault().Text; }); model.ListItem = data; CurrentUser.StoreId = model.StoreId; } } catch (Exception e) { _logger.Error("StockCountSearch: " + e); return(new HttpStatusCodeResult(400, e.Message)); } return(PartialView("_ListData", model)); }