public async Task <ActionResult <MsgContact> > PostMsgContact(MsgContact msgContact) { _context.MsgContacts.Add(msgContact); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMsgContact", new { id = msgContact.Id }, msgContact)); }
public async Task <IActionResult> PutMsgContact(int id, MsgContact msgContact) { if (id != msgContact.Id) { return(BadRequest()); } _context.Entry(msgContact).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MsgContactExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }