public async Task <ActionResult <CosmType> > PostCosmType(CosmType cosmType) { _context.CosmTypes.Add(cosmType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCosmType", new { id = cosmType.Id }, cosmType)); }
public async Task <IActionResult> PutCosmType(int id, CosmType cosmType) { if (id != cosmType.Id) { return(BadRequest()); } _context.Entry(cosmType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CosmTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }