Esempio n. 1
0
 public async Task<IActionResult> Edit(Planet planet)
 {
     if (ModelState.IsValid)
     {
         context.Update(planet);
         await context.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(planet);
 }
Esempio n. 2
0
 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);
 }