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

            context.FeedCategories.Add(toAdd);
            context.SaveChanges();
        }
Ejemplo 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();
     }
 }
Ejemplo n.º 3
0
 public List<FeedCategory> GetAllCategories()
 {
     using (var context = new RssAgregatorDataContext())
     {
         return (from category in context.FeedCategories
                 select category).ToList();
     }
 }
Ejemplo n.º 4
0
 public List<FeedSource> GetAllSources()
 {
     using (var context = new RssAgregatorDataContext())
     {
         return (from source in context.FeedSources
             select source).ToList();
     }
 }
Ejemplo 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();
     
 }
Ejemplo 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();

        }
Ejemplo 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();
     }
 }
Ejemplo 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();
     }
 }
Ejemplo n.º 9
0
 public SourceManager()
 {
     Context = new RssAgregatorDataContext();
 }