public async Task <IActionResult> CreatePersonPhone([FromBody] Person.PersonPhone value) { _db.Person_PersonPhone.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditPersonPhone(int businessEntityID, string phoneNumber, int phoneNumberTypeID, [FromBody] Person.PersonPhone value) { var existing = await _db.Person_PersonPhone.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID && x.PhoneNumber == phoneNumber && x.PhoneNumberTypeID == phoneNumberTypeID); if (existing == null) { return(NotFound()); } existing.BusinessEntityID = value.BusinessEntityID; existing.PhoneNumber = value.PhoneNumber; existing.PhoneNumberTypeID = value.PhoneNumberTypeID; existing.ModifiedDate = value.ModifiedDate; _db.Person_PersonPhone.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }