Esempio n. 1
0
 public static void DeleteUserRss(UserRss urss)
 {
     using (ISession session = sessions.OpenSession())
     using (ITransaction tx = session.BeginTransaction())
     {
         session.Delete(urss);
         tx.Commit();
     }
 }
Esempio n. 2
0
 public ActionResult AddInFavourite()
 {
     string success = "Succsesfull";
     try
     {
         dbHelper.Configure();
         if (DbHelper.FindRss("IdRss", CurrentRss).Count != 0)
         {
             success = "Ошибка. Данная РСС уже в избраных.";
         }
         var userRss = new UserRss
                           {
                               IdRss = CurrentRss,
                               IdUser = UsersController.CurrentUser.Id
                           };
         DbHelper.InsertUserRss(userRss);
     }
     catch (Exception e)
     {
         success = e.Message;
     }
     return RedirectToAction ("Index", "Home", new { value = success });
 }
Esempio n. 3
0
 public ActionResult DeleteFromFavourite()
 {
     string success = "Succsesfull";
     try
     {
         dbHelper.Configure();
         var userRss = new UserRss {IdRss = CurrentRss, IdUser = UsersController.CurrentUser.Id};
         var id = DbHelper.FindUserRssId(userRss.IdRss, userRss.IdUser)[0];
         userRss.Id = id;
         DbHelper.DeleteUserRss(userRss);
     }
     catch (Exception e)
     {
         success = e.Message;
     }
     return RedirectToAction("Index", "Home", new { value = success });
 }