public async Task <IActionResult> PutPersonUrl([FromRoute] int id, [FromBody] PersonUrl personUrl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != personUrl.Id) { return(BadRequest()); } _context.Entry(personUrl).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonUrlExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostPersonUrl([FromBody] PersonUrl personUrl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.PersonUrl.Add(personUrl); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPersonUrl", new { id = personUrl.Id }, personUrl)); }