public async Task <IActionResult> PutStoreProductVariant([FromRoute] int id, [FromBody] StoreProductVariant storeProductVariant) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != storeProductVariant.Id) { return(BadRequest()); } _context.Entry(storeProductVariant).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreProductVariantExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostStoreProductVariant([FromBody] StoreProductVariant storeProductVariant) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.StoreProductVariant.Add(storeProductVariant); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStoreProductVariant", new { id = storeProductVariant.Id }, storeProductVariant)); }