Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PUT: api/Users/5
- [ResponseType(typeof(void))]
- public async Task<IHttpActionResult> PutUser(int id, User user)
- {
- if (!ModelState.IsValid)
- {
- return BadRequest(ModelState);
- }
- if (id != user.Id)
- {
- return BadRequest();
- }
- db.Entry(user).State = EntityState.Modified;
- try
- {
- await db.SaveChangesAsync();
- }
- catch (DbUpdateConcurrencyException)
- {
- if (!UserExists(id))
- {
- return NotFound();
- }
- else
- {
- throw;
- }
- }
- return StatusCode(HttpStatusCode.NoContent);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement