Example #1
0
        public void Add(Region region)
        {
            var entity = new RegionEntity
            {
                Description = region.Description,
                TerritoryId = region.Territory.Id,
                IsActive = true,
            };

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

            region.Id = entity.Id;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRegions(RegionEntity regionEntity)
 {
     base.AddObject("Regions", regionEntity);
 }
 /// <summary>
 /// Create a new RegionEntity object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="territoryId">Initial value of the TerritoryId property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 public static RegionEntity CreateRegionEntity(global::System.Int32 id, global::System.String description, global::System.Int32 territoryId, global::System.Boolean isActive)
 {
     RegionEntity regionEntity = new RegionEntity();
     regionEntity.Id = id;
     regionEntity.Description = description;
     regionEntity.TerritoryId = territoryId;
     regionEntity.IsActive = isActive;
     return regionEntity;
 }