public async Task <IActionResult> PutUser([FromRoute] int id, [FromBody] User user) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != user.PersonalId) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutJobPosting([FromRoute] int id, [FromBody] JobPosting jobPosting) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jobPosting.JobPostingId) { return(BadRequest()); } _context.Entry(jobPosting).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobPostingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }