public async Task <IActionResult> PutSubModulos([FromRoute] int id, [FromBody] SubModulos subModulos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != subModulos.Id_SubModulos) { return(BadRequest()); } _context.Entry(subModulos).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubModulosExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostSubModulos([FromBody] SubModulos subModulos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.SubModulos.Add(subModulos); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSubModulos", new { id = subModulos.Id_SubModulos }, subModulos)); }