//Return all visible items based on selected catergory public List <Item> GetItems(ItemsCategory currentCategory) { List <Item> items = new List <Item>(); switch (currentCategory) { case ItemsCategory.All: items = GetItems(typeof(Item)); break; case ItemsCategory.Potion: items = GetItems(typeof(Potion)); break; case ItemsCategory.Weapon: items = GetItems(typeof(Weapon)); break; case ItemsCategory.Armor: items = GetItems(typeof(Armor)); break; default: Debug.LogError("Tried to get unknown category"); break; } return(items); }
public async Task <IActionResult> PutCategoriaProducto(int id, ItemsCategory categoriaProducto) { if (id != categoriaProducto.Id) { return(BadRequest()); } _context.Entry(categoriaProducto).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriaProductoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ItemsCategory> > PostCategoriaProducto(ItemsCategory categoriaProducto) { _context.ItemsCategories.Add(categoriaProducto); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCategoriaProducto", new { id = categoriaProducto.Id }, categoriaProducto)); }
public async Task <IActionResult> Edit(int id, [Bind("Name,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] ItemsCategory itemsCategory) { if (id != itemsCategory.Id) { return(this.NotFound()); } if (this.ModelState.IsValid) { try { this.dataRepository.Update(itemsCategory); await this.dataRepository.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!this.ItemsCategoryExists(itemsCategory.Id)) { return(this.NotFound()); } else { throw; } } return(this.RedirectToAction(nameof(this.Index))); } return(this.View(itemsCategory)); }
public void SelectPreviousCategory() { if (PreviousCategory(selectedCategory) == null) { Debug.LogError("Unkown Category"); } selectedCategory = PreviousCategory(selectedCategory).Value; onInventoryUpdate?.Invoke(); }
public async Task <IActionResult> Create([Bind("Name,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] ItemsCategory itemsCategory) { if (this.ModelState.IsValid) { await this.dataRepository.AddAsync(itemsCategory); await this.dataRepository.SaveChangesAsync(); return(this.RedirectToAction(nameof(this.Index))); } return(this.View(itemsCategory)); }
async Task ExecuteLoadCategoryItemsCommand() { IsBusy = true; ItemsCategory.Clear(); try { var items = await RestServiceCategory.RefreshDataAsync(); items.ForEach(category => ItemsCategory.Add(category)); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; PresentBudgetChart(ItemsCategory); } }
//Utility function to get the previous Category ItemsCategory?PreviousCategory(ItemsCategory category) { //ItemsCategory. switch (category) { case ItemsCategory.All: return(ItemsCategory.Potion); case ItemsCategory.Armor: return(ItemsCategory.Weapon); case ItemsCategory.Potion: return(ItemsCategory.Armor); case ItemsCategory.Weapon: return(ItemsCategory.All); default: Debug.LogError("Unknown Category"); return(null); } }
public void SelectShopType(ShopType newShopType) { selectedCategory = ItemsCategory.All; onInventoryUpdate?.Invoke(); }
public void SelectCategory(ItemsCategory catergory) { DeselectItem(); selectedCategory = catergory; onInventoryUpdate?.Invoke(); }