public async Task <IActionResult> PutArticleSection([FromRoute] int id, [FromBody] ArticleSection articleSection) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != articleSection.Id) { return(BadRequest()); } _context.Entry(articleSection).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticleSectionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostArticleSection([FromBody] ArticleSection articleSection) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ArticleSections.Add(articleSection); await _context.SaveChangesAsync(); return(CreatedAtAction("GetArticleSection", new { id = articleSection.Id }, articleSection)); }