Esempio n. 1
0
        public void AddCategory(FeedCategory toAdd)
        {
            var context = new RssAgregatorDataContext();

            context.FeedCategories.Add(toAdd);
            context.SaveChanges();
        }
Esempio n. 2
0
 public List<FeedCategory> GetCategoriesNumber(int number = 5)
 {
     using (var context = new RssAgregatorDataContext())
     {
         return (from category in context.FeedCategories
                 select category).Take(number).ToList();
     }
 }
Esempio n. 3
0
 public List<FeedCategory> GetAllCategories()
 {
     using (var context = new RssAgregatorDataContext())
     {
         return (from category in context.FeedCategories
                 select category).ToList();
     }
 }
Esempio n. 4
0
 public List<FeedSource> GetAllSources()
 {
     using (var context = new RssAgregatorDataContext())
     {
         return (from source in context.FeedSources
             select source).ToList();
     }
 }
Esempio n. 5
0
 public FeedCategory GetCategoryById(int id)
 {
     var context = new RssAgregatorDataContext();
     
         return (from category in context.FeedCategories
                 where category.Id == id
                 select category).SingleOrDefault();
     
 }
Esempio n. 6
0
        public List<FeedCategory> GetByUserId(string id)
        {
            var context = new RssAgregatorDataContext();

            return (from category in context.FeedCategories
                where category.UserId == id
                select category).ToList();

        }
Esempio n. 7
0
 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();
     }
 }
Esempio n. 8
0
 public void RenameModel(int categoryId, string newName)
 {
     using (var context = new RssAgregatorDataContext())
     {
         var fromDbToUpdate = (from cate in context.FeedCategories
                               where cate.Id == categoryId
                               select cate).Single();
         fromDbToUpdate.Name = newName;
         context.SaveChanges();
     }
 }
Esempio n. 9
0
 public SourceManager()
 {
     Context = new RssAgregatorDataContext();
 }