public async Task <IActionResult> PutUserGuides([FromRoute] int id, [FromBody] UserGuides userGuides) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userGuides.UserGuideId) { return(BadRequest()); } _context.Entry(userGuides).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserGuidesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostUserGuides([FromBody] UserGuides userGuides) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.UserGuides.Add(userGuides); await _context.SaveChangesAsync(); return(CreatedAtAction("GetUserGuides", new { id = userGuides.UserGuideId }, userGuides)); }