public ActionResult DeleteConfirmed(int id) { PointOfDelivery pointOfDelivery = this.db.PointsOfDeliveries.Find(id); this.db.PointsOfDeliveries.Remove(pointOfDelivery); this.db.SaveChanges(); return(this.RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Name,CoordX,CoordY")] PointOfDelivery pointOfDelivery) { if (this.ModelState.IsValid) { this.db.Entry(pointOfDelivery).State = EntityState.Modified; this.db.SaveChanges(); return(this.RedirectToAction("Index")); } return(this.View(pointOfDelivery)); }
public ActionResult Create([Bind(Include = "ID,Name,CoordX,CoordY")] PointOfDelivery pointOfDelivery) { if (this.ModelState.IsValid) { this.db.PointsOfDeliveries.Add(pointOfDelivery); this.db.SaveChanges(); return(this.RedirectToAction("Index")); } return(this.View(pointOfDelivery)); }
// GET: PointsOfDeliveries/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PointOfDelivery pointOfDelivery = this.db.PointsOfDeliveries.Find(id); if (pointOfDelivery == null) { return(this.HttpNotFound()); } return(this.View(pointOfDelivery)); }
// GET: PointsOfDeliveries/Create public ActionResult Create(string lon = "", string lat = "") { try { var pointOfDelivery = new PointOfDelivery() { CoordX = float.Parse(lon), CoordY = float.Parse(lat) }; return(this.View(pointOfDelivery)); } catch { return(this.View()); } }