private async Task <PurchasePriceFixedTable> SetupData() { //active perm var entity = new PurchasePriceFixedTable(123, 1, "permanent"); entity.StartDate = _date.ToString("yyyy-MM-dd"); entity.EndDate = _date.AddDays(5); await _context.SaveAsync(entity); //active perm entity = new PurchasePriceFixedTable(456, 1, "permanent"); entity.StartDate = _date.ToString("yyyy-MM-dd"); entity.EndDate = _date.AddDays(5); await _context.SaveAsync(entity); //active perm entity = new PurchasePriceFixedTable(456, 2, "permanent"); entity.StartDate = _date.ToString("yyyy-MM-dd"); entity.EndDate = _date.AddDays(5); await _context.SaveAsync(entity); //upcoming temp entity = new PurchasePriceFixedTable(456, 2, "temp"); entity.StartDate = _date.AddDays(3).ToString("yyyy-MM-dd"); entity.EndDate = _date.AddDays(5); await _context.SaveAsync(entity); //past temp entity = new PurchasePriceFixedTable(456, 2, "temp"); entity.StartDate = _date.AddDays(-15).ToString("yyyy-MM-dd"); entity.EndDate = _date.AddDays(-5); await _context.SaveAsync(entity); Console.WriteLine("Inserted items"); return(entity); }
private async Task Save(PurchasePriceFixedTable existingActivePrice) { //update/save price existingActivePrice.EndDate = _date.AddDays(1); await _context.SaveAsync(existingActivePrice); }