public async Task <IActionResult> PutComolaints([FromRoute] int id, [FromBody] Comolaints comolaints) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != comolaints.Id) { return(BadRequest()); } _context.Entry(comolaints).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ComolaintsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostComolaints([FromBody] Comolaints comolaints) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Comolaints.Add(comolaints); await _context.SaveChangesAsync(); return(CreatedAtAction("GetComolaints", new { id = comolaints.Id }, comolaints)); }