public async Task <ActionResult <CUserRole> > PostCUserRole(CUserRole cUserRole) { _context.CUserRole.Add(cUserRole); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCUserRole", new { id = cUserRole.Id }, cUserRole)); }
public async Task <IActionResult> PutCUserRole(int id, CUserRole cUserRole) { if (id != cUserRole.Id) { return(BadRequest()); } _context.Entry(cUserRole).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CUserRoleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }