private async Task SeedMaterialTypesData() { if (!_context.MaterialTypes.Any()) { var materialTypes = new List <MaterialType>() { new MaterialType() { Name = "Board", Memo = "Windfsurfing boards." }, new MaterialType() { Name = "Sail", Memo = "Windfsurfing sails." }, new MaterialType() { Name = "Mast", Memo = "Windfsurfing masts." }, new MaterialType() { Name = "Boom", Memo = "Windfsurfing booms." } }; foreach (var materialType in materialTypes) { materialType.UserName = TheUser; materialType.Created = DateTime.Now; _context.MaterialTypes.Add(materialType); } await _context.SaveChangesAsync(); } }
public async Task <bool> SaveChangesAsync() { return((await _context.SaveChangesAsync()) > 0); }