public ActionResult DeleteConfirmed(double id) { Safetypoint safetypoint = db.Safetypoints.Find(id); db.Safetypoints.Remove(safetypoint); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "X,Y,Cam_score,Bar_score,Cafe_score,Light_score,Street_address,Area")] Safetypoint safetypoint) { if (ModelState.IsValid) { db.Entry(safetypoint).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(safetypoint)); }
public ActionResult Create([Bind(Include = "X,Y,Cam_score,Bar_score,Cafe_score,Light_score,Street_address,Area")] Safetypoint safetypoint) { if (ModelState.IsValid) { db.Safetypoints.Add(safetypoint); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(safetypoint)); }
// GET: Safetypoints/Delete/5 public ActionResult Delete(double?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Safetypoint safetypoint = db.Safetypoints.Find(id); if (safetypoint == null) { return(HttpNotFound()); } return(View(safetypoint)); }
//Return All the safety points to the front end in JSON format public JsonResult ReturnAllSafetyPoints() { var data = db.Safetypoints.ToList(); Safetypoint safetypoint = new Safetypoint(); List <Safetypoint> safetypointList = data.Select(x => new Safetypoint { X = x.X, Y = x.Y, Bar_score = x.Bar_score, Cafe_score = x.Cafe_score, Cam_score = x.Cam_score, Light_score = x.Light_score, Street_address = x.Street_address, Area = x.Area }).ToList(); return(Json(safetypointList, JsonRequestBehavior.AllowGet)); }