Example #1
0
        public async Task <IActionResult> PutProduct2177(int id, Product2177 product2177)
        {
            if (id != product2177.Productid)
            {
                return(BadRequest());
            }

            _context.Entry(product2177).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Product2177Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Product2177> > PostProduct2177(Product2177 p)
        {
            // _context.Product2177.Add(product2177);

            _context.Database.ExecuteSqlRaw("EXEC ADD_PRODUCT @PPRODNAME = " + p.Prodname +
                                            ", @PBUYPRICE = " + p.Buyprice +
                                            ", @PSELLPRICE = " + p.Sellprice);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProduct2177", new { id = p.Prodname }, p));
        }