public JsonResult AddDoor(Door door) { try { //var door = JsonConvert.DeserializeObject<Door>(stringDoor); _doorManager.Add(door); return(Json(new { msg = "Başarılı", drm = true, data = _doorManager.Get(door) })); } catch (Exception ex) { return(Json(new { msg = ex.Message.ToString(), drm = false })); } }
public JsonResult UpdateHandle(UpdateHandlerModel model) { List <Door> doors = new List <Door>(); List <Neighbor> neighbors = new List <Neighbor>(); foreach (var fakeDoor in model.Points) { var door = _doorManager.Get(new Door { Id = fakeDoor.Id }); door.Geometry = fakeDoor.Geometry; doors.Add(door); } foreach (var fakeNeighbor in model.Polygons) { var neighbor = _neighborManager.Get(new Neighbor { Id = fakeNeighbor.Id }); neighbor.Geometry = fakeNeighbor.Geometry; neighbors.Add(neighbor); } try { UpdateHandler.Control(doors, neighbors); } catch (Exception ex) { UpdateHandler.TakeOver(); return(Json(new { msg = ex.Message, drm = false })); } return(Json(new { msg = "Başarılı", drm = true })); }
public static void Control(List <Door> doors, List <Neighbor> neighbors) { foreach (var door in doors) { dataDoors.Add(doorManager.Get(door)); doorManager.Update(door); } foreach (var neighbor in neighbors) { dataNeighbors.Add(neighborManager.Get(neighbor)); neighborManager.Update(neighbor); } Handle(doors); Handle(neighbors); }