Example #1
0
        public async Task <IActionResult> PutPayment([FromRoute] int id, [FromBody] Payment payment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != payment.PaymentId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> PutOrder([FromRoute] int?id, [FromBody] Order order)
        {
            if (id == null)
            {
                return(BadRequest());
            }


            if (id != order.OrderId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #3
0
        public ActionResult Edit(Vendor authr, int id)
        {
            Vendor auth = context.Vendors.Where(x => x.VendorId == id).SingleOrDefault();

            context.Entry(auth).CurrentValues.SetValues(authr);
            context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
        public ActionResult Edit(Vendor v1)
        {
            Vendor vend = context.vendors.Where(x => x.VendorId == v1.VendorId).SingleOrDefault();

            context.Entry(vend).CurrentValues.SetValues(v1);
            context.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(Brand brand, int id)
        {
            Brand brnd = context.Brands.Where(x => x.BrandId == id).SingleOrDefault();

            context.Entry(brnd).CurrentValues.SetValues(brnd);
            context.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(ProductCategory productcategory, int id)
        {
            var pc = context.Categories.Where(x => x.ProductCategoryId == id).SingleOrDefault();

            //prod.ProductCategoryId = productcategory.ProductCategoryId;
            //prod.CategoryName = productcategory.CategoryName;
            //prod.CategoryDescription = productcategory.CategoryDescription;
            context.Entry(pc).CurrentValues.SetValues(productcategory);
            context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #7
0
      public async Task <IActionResult> Put(int?id, [FromBody] Vendor vendor)
      {
          if (id != vendor.VendorId)
          {
              return(BadRequest());
          }
          _context.Entry(vendor).State = EntityState.Modified;

          await _context.SaveChangesAsync();

          return(NoContent());
      }
        public async Task <IActionResult> Put(int?id, [FromBody] Product product)
        {
            if (id != product.ProductId)
            {
                return(BadRequest());
            }
            _context.Entry(product).State = EntityState.Modified;

            await _context.SaveChangesAsync();


            return(NoContent());
        }
Example #9
0
        public async Task <ActionResult> Put(int?id, [FromBody] ProductCategory newproductcategory)
        {
            if (id == null)
            {
                return(BadRequest());
            }
            if (id != newproductcategory.ProductCategoryId)
            {
                return(NotFound());
            }
            _context.Entry(newproductcategory).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }