public async Task <IActionResult> PutGroup([FromRoute] Guid id, [FromForm] Group group) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != group.Id) { return(BadRequest()); } _context.Entry(group).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroupExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutSubject([FromRoute] Guid id, [FromBody] Subject subject) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != subject.Id) { return(BadRequest()); } _context.Entry(subject).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubjectExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }