// GET: FactoryInventory /// <summary> /// Index, the page that shows all the FactoryInventorys /// </summary> /// <returns></returns> public ActionResult Index() { var CurrentId = DataSourceBackend.Instance.IdentityBackend.GetCurrentStudentID(HttpContext); if (DataSourceBackend.Instance.IdentityBackend.BlockExecptForRole(CurrentId, UserRoleEnum.TeacherUser)) { return(RedirectToAction("Login", "Admin")); } // Load the list of data into the FactoryInventoryList var myData = new FactoryInventoryListViewModel(); // Get the Inventory var InventoryList = DataSourceBackend.Instance.FactoryInventoryBackend.Index(); // Sort the Inventory into List per Category // Load the ones foreach (var item in Enum.GetValues(typeof(FactoryInventoryCategoryEnum))) { var temp = new FactoryInventoryViewModel { Category = (FactoryInventoryCategoryEnum)item, FactoryInventoryList = InventoryList.Where(m => m.Category == (FactoryInventoryCategoryEnum)item).ToList() }; if (temp.FactoryInventoryList.Any()) { // todo, tag the ones that are already owned myData.FactoryInventoryCategoryList.Add(temp); } } return(View(myData)); }
public void Models_FactoryInventoryListViewModel_Default_Instantiate_Should_Pass() { // Act var result = new FactoryInventoryListViewModel(); // Assert Assert.IsNotNull(result, TestContext.TestName); }