public ActionResult Index() { CustomerRepo customerRepo = new CustomerRepo(); ItemRepo itemRepo = new ItemRepo(); PaymentTypeRepo paymentTypeRepo = new PaymentTypeRepo(); var multiModels = new Tuple <IEnumerable <SelectListItem>, IEnumerable <SelectListItem>, IEnumerable <SelectListItem> > (customerRepo.GetAllCustomers(), itemRepo.GetAllItems(), paymentTypeRepo.GetAllPaymentTypes()); return(View(multiModels)); }
public IActionResult AllItems(ItemViewModel ivm) { if (HttpContext.Session.GetString("Username") != "Admin") { return(RedirectToAction("Index", "Home")); } ivm.AllItems = new List <ItemViewModel>(); foreach (Item item in _ir.GetAllItems(ivm.Sortingtype)) { ivm.AllItems.Add(ItemToItemVM.ToItemVM(item)); } return(View(ivm)); }
public IHttpActionResult GetAllItems() { string error = ""; List <ItemModel> ims = ItemRepo.GetAllItems(out error); if (error != "" || ims == null) { if (error == ConError.Status.NOTFOUND) { return(Content(HttpStatusCode.NotFound, "Items Not Found")); } return(Content(HttpStatusCode.BadRequest, error)); } return(Ok(ims)); }
public IActionResult LoadMap(int characterID) { if (HttpContext.Session.GetString("Username") == null) { return(RedirectToAction("Login", "Account")); } var tempItemList = new List <ItemViewModel>(); foreach (Item item in _ir.GetAllItems(0)) { tempItemList.Add(ItemToItemVM.ToItemVM(item)); } var mvm = new MapViewModel { character = CharacterToCharacterVM.ToCharVM(_cr.GetById(characterID)), allitems = tempItemList }; return(View("Game", mvm)); }
public void TestLoadingGame() { //Arrange CharacterCreationViewModel ccvm = new CharacterCreationViewModel(); ICharacterContext _Icc = new TestCharacterContext(); IItemContext _IIc = new TestItemContext(); CharacterRepo _cr = new CharacterRepo(_Icc); ItemRepo _ir = new ItemRepo(_IIc); var mvm = new MapViewModel(); var tempItemList = new List <ItemViewModel>(); //Act mvm.character = CharacterToCharacterVM.ToCharVM(_cr.GetById(5)); foreach (Item item in _ir.GetAllItems(0)) { tempItemList.Add(ItemToItemVM.ToItemVM(item)); } mvm.allitems = tempItemList; //Assert Assert.IsTrue(mvm.character != null && mvm.character.CharacterModel != ""); Assert.IsTrue(mvm.allitems.Count > 0); }