public async Task <IActionResult> PutElementosPermisos([FromRoute] int id, [FromBody] ElementosPermisos elementosPermisos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != elementosPermisos.Id) { return(BadRequest()); } _context.Entry(elementosPermisos).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ElementosPermisosExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostElementosPermisos([FromBody] ElementosPermisos elementosPermisos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ElementosPermisos.Add(elementosPermisos); await _context.SaveChangesAsync(); return(CreatedAtAction("GetElementosPermisos", new { id = elementosPermisos.Id }, elementosPermisos)); }