public void AddSubcategory() { JobSubcategory item = new JobSubcategory(); item.JobCategory = SelectedCategory; JobSubcategoryRepository.Instance.SetItem(item); Subcategories.Add(item); SelectedSubcategory = item; }
public void FilterSubcategories() { var categoryId = SelectedCategory.Id; var subcategories = AllSubcategories.Where(a => a.CategoryId == categoryId).ToList(); Subcategories.Clear(); foreach (var item in subcategories) { Subcategories.Add(item); } ; }
void ITwentyThreeParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "category") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "name": CategoryName = reader.Value; break; case "path": Path = reader.Value; break; case "pathids": PathIds = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "subcat" || reader.LocalName == "group") { if (reader.LocalName == "subcat") { var c = new Subcategory(); ((ITwentyThreeParsable)c).Load(reader); Subcategories.Add(c); } else { var s = new Group(); ((ITwentyThreeParsable)s).Load(reader); Groups.Add(s); } } // Skip to next element (if any) reader.Skip(); }
public async Task Init() { var categories = await _categoryService.Get <IList <CategoryDto> >(); AllSubcategories = await _subcategoryService.Get <IList <SubcategoryDto> >(); Categories.Clear(); Subcategories.Clear(); foreach (var item in categories) { Categories.Add(item); } foreach (var item in AllSubcategories) { Subcategories.Add(item); } }
private void SearchBySubcategoryName(string name) { Subcategories.Clear(); if (!string.IsNullOrEmpty(name) || !string.IsNullOrWhiteSpace(name)) { foreach (Category c in allSubcategories) { if (c.Name.ToUpper().Contains(name.ToUpper())) { Subcategories.Add(c); } } } else { foreach (Category c in allSubcategories) { Subcategories.Add(c); } } }
public void SaveNewSubcategory(Subcategory model) { Subcategories.Add(model); SaveChanges(); }
public virtual void AddSubCategory(Category category) { Subcategories.Add(category); category.Parent = this; }
public void UpdateSubcategory(Subcategory subcategory) { Subcategories.Remove(Subcategories.First(sub => sub.ID == subcategory.ID)); Subcategories.Add(subcategory); }
public void AddSubcategory(Subcategory subcategory) { Subcategories.Add(subcategory); }