public IActionResult CreateEngine(Engine model) { if (ModelState.IsValid) { engineRepository.Add(model); } return(RedirectToAction("ListEngines")); }
public async Task <IActionResult> First() { IdentityRole identityRole = new IdentityRole { Name = "Admin" }; IdentityRole identityRole2 = new IdentityRole { Name = "User" }; IdentityUser adminUser = new IdentityUser { UserName = "******", Email = "*****@*****.**" }; await roleManager.CreateAsync(identityRole); await roleManager.CreateAsync(identityRole2); await userManager.CreateAsync(adminUser, "Admin1"); await userManager.AddToRoleAsync(adminUser, "Admin"); Engine google = new Engine { Address = "https://www.google.com", Name = "Google", Description = "Google engine" }; Engine pinterest = new Engine { Address = "https://pl.pinterest.com", Name = "Pinterest", Description = "Pinterest engine" }; engineRepository.Add(google); engineRepository.Add(pinterest); return(RedirectToAction("Index", "Home")); }