public static void SeedValuation(PropertyDbContext context) { if (!context.Valuations.Any()) { var valuationData = File.ReadAllText("./MockData/ValuationSeedData.json"); var valuations = JsonConvert.DeserializeObject <List <Valuation> >(valuationData); foreach (var valuation in valuations) { context.Valuations.Add(valuation); } context.SaveChanges(); } }
public static void SeedPropertyImage(PropertyDbContext context) { if (!context.PropertyImages.Any()) { var propertyImageData = File.ReadAllText("./MockData/PropertyImageSeedData.json"); var propertyImages = JsonConvert.DeserializeObject <List <PropertyImage> >(propertyImageData); foreach (var propertyImage in propertyImages) { context.PropertyImages.Add(propertyImage); } context.SaveChanges(); } }
public static void SeedPropertyStatus(PropertyDbContext context) { if (!context.PropertyStatuses.Any()) { var statusData = File.ReadAllText("./MockData/PropertyStatusSeedData.json"); var statusList = JsonConvert.DeserializeObject <List <PropertyStatus> >(statusData); foreach (var status in statusList) { context.PropertyStatuses.Add(status); } context.SaveChanges(); } }
public static void SeedAccount(PropertyDbContext context) { if (!context.Accounts.Any()) { var accountData = File.ReadAllText("./MockData/AccountSeedData.json"); var accounts = JsonConvert.DeserializeObject <List <Account> >(accountData); foreach (var account in accounts) { context.Accounts.Add(account); } context.SaveChanges(); } }
public static void SeedOwnershipLog(PropertyDbContext context) { if (!context.OwnershipLogs.Any()) { var ownershipLogData = File.ReadAllText("./MockData/OwnershipLogSeedData.json"); var ownershipLogs = JsonConvert.DeserializeObject <List <OwnershipLog> >(ownershipLogData); foreach (var ownershipLog in ownershipLogs) { context.OwnershipLogs.Add(ownershipLog); } context.SaveChanges(); } }
public static void SeedData(PropertyDbContext context) { SeedPropertyStatus(context); SeedPropertyType(context); SeedProperty(context); SeedPropertyImage(context); SeedRenovation(context); SeedValuation(context); SeedOwnerType(context); SeedOwner(context); SeedOwnershipLog(context); SeedAccountType(context); SeedAccount(context); }
public AccountRepository(PropertyDbContext context) { _context = context; }
public PropertyRepository(PropertyDbContext context) { _context = context; }