Example #1
0
 public static void AddFavoritesByCookies(FavoritesByCookies item)
 {
     using (var ctx = new RentooloEntities())
     {
         ctx.spAddFavoritesByCookies(item.UserCookiesId, item.AdvertId);
     }
 }
Example #2
0
        //public static List<Favorites> GetFavoritesListByCookies(string uid)
        //{
        //    var list = GetFavoritesByCookies(uid);

        //    List<Favorites> favoritesList = new List<Favorites>();

        //    foreach (var item in list)
        //    {
        //        favoritesList.Add(new Favorites
        //        {
        //            AdvertId = item.AdvertId,
        //            Created = item.Created
        //        });
        //    }

        //    return favoritesList;
        //}

        public static void DeleteFavoritesByCookies(long id)
        {
            using (var ctx = new RentooloEntities())
            {
                FavoritesByCookies obj = ctx.FavoritesByCookies.Single(x => x.Id == id);

                ctx.FavoritesByCookies.Remove(obj);

                try
                {
                    ctx.SaveChanges();
                }
                catch (System.Exception ex)
                {
                    DataHelper.AddException(ex);
                }
            }
        }