public void AddCategory(FeedCategory toAdd) { var context = new RssAgregatorDataContext(); context.FeedCategories.Add(toAdd); context.SaveChanges(); }
public void DeleteCategory(FeedCategory toDelete) { using (var context = new RssAgregatorDataContext()) { FeedCategory cat = (FeedCategory)context.FeedCategories.Where(b => b.Id == toDelete.Id).First(); context.FeedCategories.Remove(cat); context.SaveChanges(); } }
//[Scope("isLogged")] public int Add(string userId, string param) { var toCreateCategory = new FeedCategory { CreationDate = DateTime.Now, Name = param, Public = true, UserId = userId }; CategoryManager.AddCategory(toCreateCategory); return toCreateCategory.Id; }