public async Task<int> AddAsync(Raincheck raincheck) { var addedRaincheck = context.RainChecks.Add(raincheck); await context.SaveChangesAsync(CancellationToken.None); //return addedRaincheck.Entity.RaincheckId; return addedRaincheck.RaincheckId; }
/// <summary> /// Lazy loading is not currently available with EF 7.0, so this loads the Store/Product/Category information /// </summary> private async Task FillRaincheckValuesAsync(Raincheck raincheck) { raincheck.IssuerStore = await context.Stores.FirstAsync(s => s.StoreId == raincheck.StoreId); raincheck.Product = await context.Products.FirstAsync(p => p.ProductId == raincheck.ProductId); raincheck.Product.Category = await context.Categories.FirstAsync(c => c.CategoryId == raincheck.Product.CategoryId); }