public ActionResult DeleteConfirmed(int id) { PLocation pLocation = db.PLocations.Find(id); db.PLocations.Remove(pLocation); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <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; }
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)); }
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)); }
// 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)); }
/// <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); }