public async Task <IActionResult> CreateEmailAddress([FromBody] Person.EmailAddress value) { _db.Person_EmailAddress.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditEmailAddress(int businessEntityID, int emailAddressID, [FromBody] Person.EmailAddress value) { var existing = await _db.Person_EmailAddress.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID && x.EmailAddressID == emailAddressID); if (existing == null) { return(NotFound()); } existing.BusinessEntityID = value.BusinessEntityID; existing.EmailAddressID = value.EmailAddressID; existing.EmailAddress1 = value.EmailAddress1; existing.rowguid = value.rowguid; existing.ModifiedDate = value.ModifiedDate; _db.Person_EmailAddress.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }