예제 #1
0
        public void Add(Location location)
        {
            var entity = new LocationEntity
            {
                Description = location.Description,
                RegionId = location.Region.Id,
                IsActive = true,
            };

            _context.Locations.AddObject(entity);
            _context.SaveChanges();

            location.Id = entity.Id;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Locations EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLocations(LocationEntity locationEntity)
 {
     base.AddObject("Locations", locationEntity);
 }
 /// <summary>
 /// Create a new LocationEntity object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="regionId">Initial value of the RegionId property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 public static LocationEntity CreateLocationEntity(global::System.Int32 id, global::System.String description, global::System.Int32 regionId, global::System.Boolean isActive)
 {
     LocationEntity locationEntity = new LocationEntity();
     locationEntity.Id = id;
     locationEntity.Description = description;
     locationEntity.RegionId = regionId;
     locationEntity.IsActive = isActive;
     return locationEntity;
 }