/// <summary>
 /// Create a new DWindFarmTurbine object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="windFarmId">Initial value of the WindFarmId property.</param>
 /// <param name="number">Initial value of the Number property.</param>
 /// <param name="x">Initial value of the X property.</param>
 /// <param name="y">Initial value of the Y property.</param>
 /// <param name="z">Initial value of the Z property.</param>
 public static DWindFarmTurbine CreateDWindFarmTurbine(global::System.Guid id, global::System.Guid windFarmId, global::System.Int32 number, global::System.Decimal x, global::System.Decimal y, global::System.Decimal z)
 {
     DWindFarmTurbine dWindFarmTurbine = new DWindFarmTurbine();
     dWindFarmTurbine.Id = id;
     dWindFarmTurbine.WindFarmId = windFarmId;
     dWindFarmTurbine.Number = number;
     dWindFarmTurbine.X = x;
     dWindFarmTurbine.Y = y;
     dWindFarmTurbine.Z = z;
     return dWindFarmTurbine;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the DWindFarmTurbines EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDWindFarmTurbines(DWindFarmTurbine dWindFarmTurbine)
 {
     base.AddObject("DWindFarmTurbines", dWindFarmTurbine);
 }
        public JsonResult TurbineCoordinatesSave(Guid windFarmId, List<decimal[]> turbines)
        {
            if (turbines == null) return Json("Bad model");

            _ctx.DWindFarmTurbines.Where(x => x.WindFarmId == windFarmId).ForEach(x => _ctx.DWindFarmTurbines.DeleteObject(x));

            for (var i = 0; i < turbines.Count; i++)
            {
                var item = new DWindFarmTurbine
                {
                    Id = Guid.NewGuid(),
                    WindFarmId = windFarmId,
                    Number = (int)turbines[i][0],
                    X = turbines[i][1],
                    Y = turbines[i][2]
                };

                _ctx.DWindFarmTurbines.AddObject(item);
            }
            _ctx.SaveChanges();
            return Json("OK");
        }