//******BELOW ARE ALL OF THE HELPER METHODS****** private List <ItemTagsLocation> FindMyInventory(RoboDexer loggedInRoboDexer) { var allItems = _repo.Inventory.FindAll().ToList(); List <ItemTagsLocation> myItemsList = new List <ItemTagsLocation>(); foreach (Inventory item in allItems) { ItemTagsLocation itemTagsLocation = new ItemTagsLocation(); var roboDexerItems = _repo.Items.FindByCondition(i => i.ItemId == item.ItemId).SingleOrDefault(); if (roboDexerItems == null) { continue; } if (item.RoboDexerId == loggedInRoboDexer.RoboDexerId) { var allInventory = _repo.Inventory.FindByCondition(i => i.ItemId == roboDexerItems.ItemId).SingleOrDefault(); //var tags = _repo.Tags.FindByCondition(i => i.TagId == roboDexerItems.TagId).SingleOrDefault(); var location = _repo.LocationPlace.FindByCondition(l => l.LocationId == roboDexerItems.LocationId).SingleOrDefault(); itemTagsLocation.Inventory = item; itemTagsLocation.Items = roboDexerItems; //itemTagsLocation.Tags = tags; itemTagsLocation.LocationPlace = location; myItemsList.Add(itemTagsLocation); } } return(myItemsList); }
// GET: RoboDexerController/Create public ActionResult Create() { //NavLayout(); RoboDexer roboDexer = new RoboDexer(); return(View(roboDexer)); }
public ActionResult Create(RoboDexer robodexer) { //NavLayout(); if (ModelState.IsValid) { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); robodexer.IdentityUserId = userId; _repo.RoboDexer.Create(robodexer); _repo.Save(); } robodexer.InboxId = robodexer.RoboDexerId; robodexer.InventoryId = robodexer.RoboDexerId; robodexer.ShoppingCartId = robodexer.RoboDexerId; _repo.Save(); try { return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult EditProfile(RoboDexer roboDexer) { _repo.RoboDexer.Update(roboDexer); _repo.Save(); return(RedirectToAction("Index")); }