public void FavorilereEkle(int id) { int kid = Convert.ToInt32(Session["id"]); Kullanıcı k = m.Kullanıcı.Where(x => x.ID == kid).FirstOrDefault(); FavoriOtel f = new FavoriOtel(); f.KullanıcıID = kid; f.OtelID = id; m.FavoriOtel.Add(f); m.SaveChanges(); }
//checks if user has the hotel with given id in his favourites public Boolean FavoriKontrol(int id) { if (Session["id"] != null) { int kid = Convert.ToInt32(Session["id"]); FavoriOtel f = m.FavoriOtel.Where(x => x.KullanıcıID == kid && x.OtelID == id).FirstOrDefault(); if (f != null) { return(true); } } return(false); }