public async Task <IActionResult> PutAdmin(int id, Admin admin)
        {
            if (id != admin.AdminID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public void Atualizar(Produto produto)
 {
     if (ProdutoExists(produto.Id))
     {
         _context.Entry(produto).State = EntityState.Modified;
         _context.SaveChanges();
     }
 }
 public void UpdateCategory(Category category)
 {
     using (var context = new ECommerceDbContext())
     {
         context.Entry(category).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void UpdateProduct(Product product)
 {
     using (var context = new ECommerceDbContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public ActionResult Edit([Bind(Include = "SupplierId,Name")] Supplier supplier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(supplier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(supplier));
 }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "SellId,SellNumver,Date,BuyerName,BuyerDoc,PhoneNumber,TotalPrice")] Sell sell)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sell).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sell));
 }
Beispiel #7
0
 public ActionResult Edit(Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
Beispiel #8
0
 public ActionResult Edit([Bind(Include = "CategoryId,Name")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Beispiel #9
0
 public ActionResult Edit([Bind(Include = "Id,OrderDate,CustomerId")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Firstname", order.CustomerId);
     return(View(order));
 }
Beispiel #10
0
 public bool Atualizar(Estoque estoque)
 {
     if (Exists(estoque))
     {
         _context.Entry(estoque).State = EntityState.Modified;
         _context.SaveChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public ActionResult CheckOut(CheckOutViewModel viewModel)
        {
            var basket = context.Baskets.Find(viewModel.BasketId);

            if (basket == null)
            {
                return(RedirectToAction("PageNotFound", "System"));
            }

            basket.billingaddressid  = viewModel.SelectedBillingAddressId;
            basket.paymentmethodid   = viewModel.SelectedPaymentMethodId;
            basket.shippingaddressid = viewModel.SelectedShippingAddressId;
            basket.shippingmethodid  = viewModel.SelectedShippingMethodId;
            basket.userid            = viewModel.UserId;

            context.Baskets.Attach(basket);
            context.Entry(basket).State = EntityState.Modified;
            context.SaveChanges();

            return(RedirectToAction("Index", "Home"));
        }
Beispiel #12
0
 public void Edit(int id, Customer customer)
 {
     db.Entry(customer).State = EntityState.Modified;
     db.SaveChanges();
 }