public async Task <IActionResult> PutTypePermis([FromRoute] int id, [FromBody] TypePermis typePermis) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != typePermis.Id) { return(BadRequest()); } _context.Entry(typePermis).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypePermisExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTypePermis([FromBody] TypePermis typePermis) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TypePermis.Add(typePermis); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTypePermis", new { id = typePermis.Id }, typePermis)); }