public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { Specialtys = new SelectList(await _context.Specialtys.ToListAsync(), "Id", "Name"); return(Page()); } _context.Attach(Student).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(Student.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Specialty).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpecialtyExists(Specialty.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }