public async Task <ActionResult <HomeResidence> > PostHomeResidence(HomeResidence homeResidence) { _context.HomeResidences.Add(homeResidence); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHomeResidence", new { id = homeResidence.Id }, homeResidence)); }
public async Task <IActionResult> PutHomeResidence(int id, HomeResidence homeResidence) { if (id != homeResidence.Id) { return(BadRequest()); } _context.Entry(homeResidence).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HomeResidenceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }