public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Device).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeviceExists(Device.Id)) { return(NotFound()); } else { throw; } } DatabaseService.Init(); return(RedirectToPage("./Index")); }