public async Task <IActionResult> PutClasscard(string id, Classcard classcard) { if (id != classcard.Classid) { return(BadRequest()); } _context.Entry(classcard).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClasscardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Classcard> > PostClasscard(Classcard classcard) { _context.Classcard.Add(classcard); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ClasscardExists(classcard.Classid)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetClasscard", new { id = classcard.Classid }, classcard)); }