public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(BeaconItem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BeaconItemExists(BeaconItem.BeaconId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.beaconItems.Add(BeaconItem); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } BeaconItem = await _context.beaconItems.FindAsync(id); if (BeaconItem != null) { _context.beaconItems.Remove(BeaconItem); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }