public async Task <IActionResult> PutActivityGrades([FromRoute] int id, [FromBody] ActivityGrades activityGrades) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != activityGrades.AutoId) { return(BadRequest()); } _context.Entry(activityGrades).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActivityGradesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostActivityGrades([FromBody] ActivityGrades activityGrades) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ActivityGrades.Add(activityGrades); await _context.SaveChangesAsync(); return(CreatedAtAction("GetActivityGrades", new { id = activityGrades.AutoId }, activityGrades)); }