public async Task <ActionResult <DNDCategory> > PostDNDCategory(DNDCategory dNDCategory) { _context.DNDCategories.Add(dNDCategory); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDNDCategory", new { id = dNDCategory.Id }, dNDCategory)); }
public async Task <IActionResult> PutDNDCategory(int id, DNDCategory dNDCategory) { if (id != dNDCategory.Id) { return(BadRequest()); } _context.Entry(dNDCategory).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DNDCategoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }