public async Task <ActionResult <BagWithLetters> > PostBagWithLetters(BagWithLetters bagWithLetters) { _context.BagWithLetters.Add(bagWithLetters); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBagWithLetters", new { id = bagWithLetters.Id }, bagWithLetters)); }
public async Task <IActionResult> PutBagWithLetters(int id, BagWithLetters bagWithLetters) { if (id != bagWithLetters.Id) { return(BadRequest()); } _context.Entry(bagWithLetters).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BagWithLettersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }