public async Task <ActionResult <HeadStaffs> > PostHeadStaffs(HeadStaffs headStaffs) { _context.HeadStaffs.Add(headStaffs); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHeadStaffs", new { id = headStaffs.HeadStaffId }, headStaffs)); }
public async Task <IActionResult> PutHeadStaffs(int id, HeadStaffs headStaffs) { if (id != headStaffs.HeadStaffId) { return(BadRequest()); } _context.Entry(headStaffs).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HeadStaffsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }