public ActionResult EditLocation(LocationModel model) { if (!SessionManager.checkCurrentUserType(UserType.MAINTENANCE_PERSON)) { return(new HttpStatusCodeResult(403)); } if (ModelState.IsValid) { BL.Location l = MainClass.Instance.getLocations().Find(v => v.id == model.id); if (l != null) { l.name = model.name; l.point.latitude = (decimal)System.Web.HttpContext.Current.Session["mapLatitude"]; l.point.longitude = (decimal)System.Web.HttpContext.Current.Session["mapLongitude"]; l.point.saveInDB(); if (l.saveInDB() != null) { return(RedirectToAction("ViewLocation", "Boat")); } } } ViewBag.Status = false; ViewBag.Message = "Could not edit location"; return(View()); }