public async Task <ActionResult <UserLivingCost> > PostUserLivingCost(UserLivingCost userLivingCost) { _context.UserLivingCosts.Add(userLivingCost); await _context.SaveChangesAsync(); return(CreatedAtAction("GetUserLivingCost", new { id = userLivingCost.Id }, userLivingCost)); }
public async Task <IActionResult> PutUserLivingCost(long id, UserLivingCost userLivingCost) { if (id != userLivingCost.Id) { return(BadRequest()); } _context.Entry(userLivingCost).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserLivingCostExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }