public async Task <IActionResult> PutLanternCard([FromRoute] Guid id, [FromBody] LanternCard lanternCard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != lanternCard.LanternCardId) { return(BadRequest()); } _context.Entry(lanternCard).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LanternCardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostLanternCard([FromBody] LanternCard lanternCard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.LanternCards.Add(lanternCard); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLanternCard", new { id = lanternCard.LanternCardId }, lanternCard)); }