public async Task <ActionResult <UserToFamily> > PostUserToFamily(UserToFamily userToFamily) { _context.UserToFamily.Add(userToFamily); await _context.SaveChangesAsync(); return(CreatedAtAction("GetUserToFamily", new { id = userToFamily.Id }, userToFamily)); }
public async Task <IActionResult> PutUserToFamily(int id, UserToFamily userToFamily) { if (id != userToFamily.Id) { return(BadRequest()); } _context.Entry(userToFamily).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserToFamilyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }