public async Task <IActionResult> PutAnla([FromRoute] int id, [FromBody] Anla anla) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != anla.id) { return(BadRequest()); } _context.Entry(anla).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnlaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostAnla([FromBody] Anla anla) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Anla.Add(anla); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAnla", new { id = anla.id }, anla)); }