private static void AddInitialServiceArea(this IDbAppContext context, ServiceArea initialServiceArea) { ServiceArea serviceArea = context.GetServiceAreaByMinistryServiceAreaId(initialServiceArea.MinistryServiceAreaID); if (serviceArea != null) { return; } serviceArea = new ServiceArea { MinistryServiceAreaID = initialServiceArea.MinistryServiceAreaID, Name = initialServiceArea.Name, StartDate = initialServiceArea.StartDate }; if (initialServiceArea.District != null) { District district = context.GetDistrictByMinistryDistrictId(initialServiceArea.District.MinistryDistrictID); serviceArea.District = district; } else { serviceArea.District = null; } context.ServiceAreas.Add(serviceArea); context.SaveChanges(); }
private static void AddInitialServiceArea(this IDbAppContext context, ServiceArea initialServiceArea) { ServiceArea serviceArea = context.GetServiceAreaByMinistryServiceAreaId(initialServiceArea.MinistryServiceAreaID); if (serviceArea != null) { return; } serviceArea = new ServiceArea { MinistryServiceAreaID = initialServiceArea.MinistryServiceAreaID, Name = initialServiceArea.Name, StartDate = initialServiceArea.StartDate, AppCreateUserid = SystemId, AppCreateTimestamp = DateTime.UtcNow, AppLastUpdateUserid = SystemId, AppLastUpdateTimestamp = DateTime.UtcNow }; if (initialServiceArea.District != null) { District district = context.GetDistrictByMinistryDistrictId(initialServiceArea.District.MinistryDistrictID); serviceArea.District = district; } else { serviceArea.District = null; } context.ServiceAreas.Add(serviceArea); }