public async Task <IActionResult> PutProduct9144(int id, Product9144 product9144) { if (id != product9144.Productid) { return(BadRequest()); } _context.Entry(product9144).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Product9144Exists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Product9144> > PostProduct9144(Product9144 p) { // _context.Product9144.Add(product9144); _context.Database.ExecuteSqlRaw("EXEC ADD_PRODUCT @PPRODNAME = " + p.Prodname + ", @PBUYPRICE = " + p.Buyprice + ", @PSELLPRICE = " + p.Sellprice); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProduct9144", new { id = p.Prodname }, p)); }