public async Task <IActionResult> PutPortfolio(int id, Portfolio portfolio) { if (id != portfolio.Id) { return(BadRequest()); } _context.Entry(portfolio).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PortfolioExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPerson(int id, Person person) { if (id != person.Id) { return(BadRequest("No ID provided for person.")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Entry(person).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }