private void OnCategoryClick(CategoryToClient category) { ArticleList = new ObservableCollection <ArticleToClient>(client.GetAllArticlesInCategory(category.Id)); NotifyPropertyChanged("ArticleList"); ArticleListVisibility = true; NotifyPropertyChanged("ArticleListVisibility"); ArticleVisibility = false; NotifyPropertyChanged("ArticleVisibility"); }
public CategoryToClient EditCategory(CategoryToClient oldCategory, string newName) { Category category = context.Categories.Find(oldCategory.Id); category.Name = newName; context.SaveChanges(); CategoryToClient categoryToClient = new CategoryToClient(); categoryToClient.Id = oldCategory.Id; categoryToClient.Name = newName; return(categoryToClient); }
public CategoryToClient AddCategory(string NewCategoryName) { CategoryToClient newCategory = new CategoryToClient { Name = NewCategoryName }; context.Categories.Add(new Category { Name = NewCategoryName }); context.SaveChanges(); return(newCategory); }