Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PLocation pLocation = db.PLocations.Find(id);

            db.PLocations.Remove(pLocation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 /// <summary>
 /// finds all predicates that describe the goal positions
 /// </summary>
 /// <returns>return a list of predicates</returns>
 public IList<StackItem> FindGoalStatePredicates()
 {
     IList<StackItem> predicates = new List<StackItem>();
     foreach (KeyValuePair<Furniture, Rectangle> pair in board.furnitureDestination)
     {
         Predicate newPredicate = new PLocation(pair.Key, pair.Value);
         predicates.Add(newPredicate);
     }
     return predicates;
 }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "LocationID,City,Country,ProvinceOrState")] PLocation pLocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pLocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pLocation));
 }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "LocationID,City,Country,ProvinceOrState")] PLocation pLocation)
        {
            if (ModelState.IsValid)
            {
                db.PLocations.Add(pLocation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pLocation));
        }
Esempio n. 5
0
        // GET: PLocations/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PLocation pLocation = db.PLocations.Find(id);

            if (pLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(pLocation));
        }
Esempio n. 6
0
 /// <summary>
 /// Checks if predicate rectangle is in location rectangle
 /// </summary>
 /// <param name="locationPredicate"></param>
 /// <returns></returns>
 private bool CheckLocation(PLocation locationPredicate)
 {
     return this.board.IsFurnitureInRectangle(locationPredicate.furniture.ID, locationPredicate.rect);
 }