Esempio n. 1
0
 public static void DeleteRss(DbRss rss)
 {
     using (ISession session = sessions.OpenSession())
     using (ITransaction tx = session.BeginTransaction())
     {
         session.Delete(rss);
         tx.Commit();
     }
 }
Esempio n. 2
0
 public ActionResult AddNewRss(AddRssModel model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.Rss))
         {
             return Json(new { error = ViewResource.SharedStrings.CantBeEmpty });
         }
         if (DbHelper.FindRss("Url", model.Rss).Count != 0)
         {
             return Json(new { error = ViewResource.SharedStrings.AlreadyExists });
         }
         var rss = new RssItem(model.Rss);
         dbHelper.Configure();
         var dbRss = new DbRss {Url = model.Rss, Title = rss.Channel.Title};
         DbHelper.InsertRss(dbRss);
         return Json(new { url = Url.Action("Index", "Home") });
     }
     catch (Exception)
     {
         return Json(new { error = ViewResource.SharedStrings.CheckCorrect } );
     }
 }