public async Task <ActionResult <CmContact> > PostCmContact(CmContact cmContact) { _context.CmContacts.Add(cmContact); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCmContact", new { id = cmContact.Id }, cmContact)); }
public async Task <IActionResult> PutCmContact(int id, CmContact cmContact) { if (id != cmContact.Id) { return(BadRequest()); } _context.Entry(cmContact).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CmContactExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }