Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            FavoritePlaces favoritePlaces = db.FavoritePlaces.Find(id);

            db.FavoritePlaces.Remove(favoritePlaces);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public long AddFavoritePlace(FavoritePlace favoritePlace)
        {
            if (FavoritePlaces.Count == MAX_FAVORITE_PLACES)
            {
                return(-2);
            }

            favoritePlace.Id = favoritePlaceIdGenerator++;
            FavoritePlaces.Add(favoritePlace);
            return(favoritePlace.Id);
        }
Beispiel #3
0
 public void RefreshFavoritePlaces()
 {
     FavoritePlaces.Clear();
     foreach (var place in Settings.Settings.Instance.Places)
     {
         FavoritePlaces.Add(new FavoritePlace()
         {
             PositionText = place.Add.PlaceName,
             Place        = place.Add
         });
     }
 }
Beispiel #4
0
        public ActionResult DeleteMyFav(int id)
        {
            FavoritePlaces favoritePlaces = db.FavoritePlaces.Find(id);

            if (favoritePlaces != null)
            {
                db.FavoritePlaces.Remove(favoritePlaces);
                db.SaveChanges();
            }

            return(RedirectToAction("MyFavoritePlaces"));
        }
Beispiel #5
0
 public ActionResult Edit([Bind(Include = "FavoritePlaceID,PlaceID,ID,CreateDate,Enabled")] FavoritePlaces favoritePlaces)
 {
     if (ModelState.IsValid)
     {
         db.Entry(favoritePlaces).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PlaceID = new SelectList(db.Place, "PlaceID", "Name", favoritePlaces.PlaceID);
     ViewBag.ID      = new SelectList(db.Member, "ID", "FirstName1", favoritePlaces.ID);
     return(View(favoritePlaces));
 }
Beispiel #6
0
        //public ActionResult Remove(int PlaceID, long ID)
        //{
        //    FavoritePlaces fpRemove = db.FavoritePlaces.Where(f => f.ID == ID && f.PlaceID == PlaceID).FirstOrDefault();

        //    if (fpRemove != null)
        //    {
        //        db.FavoritePlaces.Remove(fpRemove);
        //        db.SaveChanges();
        //    }

        //    return RedirectToAction("Details", "Places", new { id = (long)PlaceID });
        //}

        public ActionResult Remove(string PlaceID, long ID)
        {
            FavoritePlaces fpRemove = db.FavoritePlaces.Where(f => f.ID == ID && f.GPlace_Id == PlaceID).FirstOrDefault();

            if (fpRemove != null)
            {
                db.FavoritePlaces.Remove(fpRemove);
                db.SaveChanges();
            }

            return(RedirectToAction("Details", "Places", new { id = PlaceID }));
        }
Beispiel #7
0
        // GET: FavoritePlaces/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FavoritePlaces favoritePlaces = db.FavoritePlaces.Find(id);

            if (favoritePlaces == null)
            {
                return(HttpNotFound());
            }
            return(View(favoritePlaces));
        }
Beispiel #8
0
        public ActionResult Add(string PlaceID)
        {
            FavoritePlaces fp = new FavoritePlaces();

            //fp.PlaceID = PlaceID;
            fp.ID          = (int)config.LoggedInMember.ID;
            fp.DateCreated = DateTime.Now;
            fp.Enabled     = true;
            fp.GPlace_Id   = PlaceID;

            db.FavoritePlaces.Add(fp);
            db.SaveChanges();

            return(RedirectToAction("Details", "Places", new { id = PlaceID }));
        }
Beispiel #9
0
        // GET: FavoritePlaces/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FavoritePlaces favoritePlaces = db.FavoritePlaces.Find(id);

            if (favoritePlaces == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PlaceID = new SelectList(db.Place, "PlaceID", "Name", favoritePlaces.PlaceID);
            ViewBag.ID      = new SelectList(db.Member, "ID", "FirstName1", favoritePlaces.ID);
            return(View(favoritePlaces));
        }