public async Task <IActionResult> OnPostAsync(int Id) { if (!ModelState.IsValid) { return(Page()); } _db.Attach(Phones).State = EntityState.Modified; try { await _db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhonesExists(Phones.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("Index")); }
public async Task <IActionResult> OnPost() { if (ModelState.IsValid) { await _db.Phones.AddAsync(Phones); await _db.SaveChangesAsync(); return(RedirectToPage("Index")); } else { return(Page()); } }