public async Task<IActionResult> Edit(Planet planet) { if (ModelState.IsValid) { context.Update(planet); await context.SaveChangesAsync(); return RedirectToAction("Index"); } return View(planet); }
public async Task<IActionResult> Create(Planet planet) { if (ModelState.IsValid) { planet.Id = Guid.NewGuid(); context.Planets.Add(planet); await context.SaveChangesAsync(); return RedirectToAction("Index"); } return View(planet); }