public async Task EnsureSeedDataAsync() { var userFound = await m_userManager.FindByEmailAsync("*****@*****.**"); if (userFound == null) { var newUser = new ChirpUser() { UserName = "******", Email = "*****@*****.**" }; var userRes = await m_userManager.CreateAsync(newUser, "qwertyui"); } m_context.SaveChanges(); if (!m_context.ChirpPosts.Any()) { //Add new data var chirpPost = new ChirpPost() { Message = "First message! ChirpChirp!", PostTime = DateTimeOffset.UtcNow, User = await m_userManager.FindByEmailAsync("*****@*****.**") }; m_context.ChirpPosts.Add(chirpPost); m_context.SaveChanges(); } }
public bool SaveAll() { return(m_context.SaveChanges() > 0); }