public async Task <IActionResult> PutDenunciaMovimento([FromRoute] int id, [FromBody] DenunciaMovimento denunciaMovimento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != denunciaMovimento.IdDenunciaMovimento) { return(BadRequest()); } _context.Entry(denunciaMovimento).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DenunciaMovimentoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostDenunciaMovimento([FromBody] DenunciaMovimento denunciaMovimento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.DenunciaMovimento.Add(denunciaMovimento); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (DenunciaMovimentoExists(denunciaMovimento.IdDenunciaMovimento)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetDenunciaMovimento", new { id = denunciaMovimento.IdDenunciaMovimento }, denunciaMovimento)); }
public async Task <IActionResult> GetDenunciaMovimento([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } DenunciaMovimento denunciaMovimento = await _context.DenunciaMovimento.SingleOrDefaultAsync(m => m.IdDenunciaMovimento == id); if (denunciaMovimento == null) { return(NotFound()); } return(Ok(denunciaMovimento)); }