public async Task <IActionResult> PutSquaresCatalog(string param1, int id, SquaresCatalog squaresCatalog) { if (id != squaresCatalog.SquareNum) { return(BadRequest()); } _context.Entry(squaresCatalog).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SquaresCatalogExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <SquaresCatalog> > PostSquaresCatalog(SquaresCatalog squaresCatalog) { _context.SquaresCatalogs.Add(squaresCatalog); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSquaresCatalog", new { id = squaresCatalog.SquareNum }, squaresCatalog)); }
public async Task <ActionResult <SquaresCatalog> > PostSquaresCatalog(SquaresCatalog squaresCatalog) { _context.SquaresCatalogs.Add(squaresCatalog); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (SquaresCatalogExists(squaresCatalog.SquareNum)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetSquaresCatalog", new { id = squaresCatalog.SquareNum }, squaresCatalog)); }