public async Task <IActionResult> PutUsers([FromRoute] int id, [FromBody] Users users) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != users.Id) { return(BadRequest()); } _context.Entry(users).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersExists(id)) { var currError = new { error = "User not found." }; return(new JsonResult(currError)); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTimeBlocks([FromRoute] int id, [FromBody] TimeBlocks timeBlocks) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != timeBlocks.Id) { return(BadRequest()); } _context.Entry(timeBlocks).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimeBlocksExists(id)) { return(NotFound()); } else { throw; } } TimeBlocks retTimeBlock = _context.TimeBlocks.Where(newT => newT.Id == id).FirstOrDefault(); return(new JsonResult(retTimeBlock)); }
public async Task<IActionResult> PutUserSkills([FromRoute] int id, [FromBody] UserSkills userSkills) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != userSkills.Id) { return BadRequest(); } _context.Entry(userSkills).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserSkillsExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
public async Task <IActionResult> PutOrganizationEmployees([FromRoute] int id, [FromBody] OrganizationEmployees organizationEmployees) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != organizationEmployees.Id) { return(BadRequest()); } _context.Entry(organizationEmployees).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrganizationEmployeesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }