コード例 #1
0
 public async Task<IActionResult> Edit(Devices devices)
 {
     if (ModelState.IsValid)
     {
         _context.Update(devices);
         await _context.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(devices);
 }
コード例 #2
0
 public async Task<IActionResult> Create(Devices devices)
 {
     devices.ActivationDate = System.DateTime.Now;
     if (ModelState.IsValid)
     {
         
         _context.Devices.Add(devices);
         await _context.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(devices);
 }