public async Task <IActionResult> PutProductGroupDetail(int id, ProductGroupDetail productGroupDetail) { if (id != productGroupDetail.Id) { return(BadRequest()); } _context.Entry(productGroupDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductGroupDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ProductGroupDetail> > PostProductGroupDetail(ProductGroupDetail productGroupDetail) { _context.ProductGroupDetail.Add(productGroupDetail); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ProductGroupDetailExists(productGroupDetail.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetProductGroupDetail", new { id = productGroupDetail.Id }, productGroupDetail)); }