public Obstacle ModifyObstacle(Obstacle newObstacle) { using (var db = new DatabaseContext()) { db.Entry(newObstacle).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return (Obstacle)db.Obstacles.Find(newObstacle.ObstacleId); } }
public Obstacle CreateObstacle(Obstacle obstacle) { using (var db = new DatabaseContext()) { Obstacle CreateObstacle = (Obstacle)db.Obstacles.Add((EntityFramework.Obstacle)obstacle); db.SaveChanges(); return CreateObstacle; } }