public OrderController(WildeRoverMgmtAppContext context, UserManager <User> userManager) { _userManager = userManager; _context = context; //Get latest OrderSummary (TODO: change to also query for user as well) var current = (from o in _context.OrderLog.Include("OrderList.Item") orderby o.Date descending select o).FirstOrDefault(); //If there is no uncompleted order if (current == null || current.Completed) { //Create new OrderSummary current = new OrderSummary(); current.Completed = false; current.Date = DateTime.Now; _context.OrderLog.Add(current); _context.SaveChanges(); current = (from o in _context.OrderLog.Include("OrderList.Item") orderby o.Date descending select o).FirstOrDefault(); } _order = current; }
public InventoryController(WildeRoverMgmtAppContext context, UserManager <User> userManager) { _userManager = userManager; _context = context; //Get latest inventory summary if it exists var current = (from i in _context.InventoryLog.Include("InventoryAreaLogs.Inventory.Item") orderby i.Date descending select i).FirstOrDefault(); //No inventory log created for the day if (current == null || current.Submitted) { _summary = new InventorySummary(); _summary.Date = DateTime.Now; _summary.Submitted = false; _context.InventoryLog.Add(_summary); _context.SaveChanges(); _summary = (from i in _context.InventoryLog.Include("InventoryAreaLogs.Inventory.Item") orderby i.Date descending select i).FirstOrDefault(); _context.InventoryLog.Update(_summary); CreateInventoryAreaLogs(_summary); _context.SaveChanges(); } else //Log exists { _summary = current; } }
public OrderSummaryController(WildeRoverMgmtAppContext context) { _context = context; }
public InventoryAreaController(WildeRoverMgmtAppContext context) { _context = context; }
public SelectOptionService(WildeRoverMgmtAppContext context) { _context = context; }
public VendorItemsController(WildeRoverMgmtAppContext context) { _context = context; }
public HomeController(WildeRoverMgmtAppContext context) { _context = context; }
public InventorySummaryController(WildeRoverMgmtAppContext context, UserManager <User> userManager) { _context = context; _userManager = userManager; }