public async Task <IActionResult> PutSchoolDepartments(int id, SchoolDepartments schoolDepartments) { if (id != schoolDepartments.Id) { return(BadRequest()); } _context.Entry(schoolDepartments).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchoolDepartmentsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <SchoolDepartments> > PostSchoolDepartments(SchoolDepartments schoolDepartments) { _context.SchoolDepartments.Add(schoolDepartments); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSchoolDepartments", new { id = schoolDepartments.Id }, schoolDepartments)); }