public ActionResult CreditCardInfo(string status, int id)
        {
            var order = db.Orders.Find(id);

            status                = "Ödeme Yapıldı";
            order.Status          = status;
            db.Entry(order).State = EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("Buy", "Home"));
        }
Esempio n. 2
0
 public ActionResult Edit(Category model)
 {
     try
     {
         Category category = db.Categories.Find(model.ID);
         category.Name            = model.Name;
         category.Description     = model.Description;
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(Json(new
         {
             state = 1,
             Result = "Kategori Güncellendi."
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             state = 0,
             Result = "Kategori Güncellenirken Bir Hata ile Karşılaşıldı.",
             Log = ex.ToString()
         }));
     }
 }
Esempio n. 3
0
        //[ActionName("byid")]
        //[ResponseType(typeof(CustmerViewModel))]
        //public IHttpActionResult GetCustomer(int id)
        //{
        //    var model = GetCustomerModel(id);
        //    if (model == null)
        //        return NotFound();
        //    return Ok(model);


        //    //return Ok(model);
        //}

        // PUT api/Customer/5
        public IHttpActionResult PutCustomer(int id, Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customer.ID)
            {
                return(BadRequest());
            }

            db.Entry(customer).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 4
0
 //método para alterar um produto
 public static void AlterarProduto(Produto produto)
 {
     using (var ctx = new ECommerceEntities())
     {
         ctx.Entry <Produto>(produto).State = EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Esempio n. 5
0
 //método para alterar o cliente
 public static void AlterarCliente(Cliente cliente)
 {
     using (var ctx = new ECommerceEntities())
     {
         ctx.Entry <Cliente>(cliente).State = EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Esempio n. 6
0
 //método para remover o cliente
 public static void RemoverCliente(Cliente cliente)
 {
     using (var ctx = new ECommerceEntities())
     {
         ctx.Entry <Cliente>(cliente).State = EntityState.Deleted;
         ctx.SaveChanges();
     }
 }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "Id,Name,Stock,Price")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "Id,Name,Birthdate,City,PostalCode")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Esempio n. 9
0
 public ActionResult Edit([Bind(Include = "MemberID,UserName,Password,Email,FirstName,LastName,Phone,Gender,BirthDate")] Member member)
 {
     if (ModelState.IsValid)
     {
         db.Entry(member).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(member));
 }
Esempio n. 10
0
 public ActionResult Edit([Bind(Include = "AddressID,MemberID,Address1,ZipCode,City,State,Country")] Address address)
 {
     if (ModelState.IsValid)
     {
         db.Entry(address).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MemberID = new SelectList(db.Members, "MemberID", "UserName", address.MemberID);
     return(View(address));
 }
Esempio n. 11
0
 public ActionResult Edit([Bind(Include = "ImageID,ProductID,ImageURL")] ProductImage productImage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productImage).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", productImage.ProductID);
     return(View(productImage));
 }
Esempio n. 12
0
 public ActionResult Edit([Bind(Include = "OrderItemID,OrderID,ProductID,Quantity")] OrderItem orderItem)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orderItem).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.OrderID = new SelectList(db.Orders, "OrderID", "OrderID", orderItem.OrderID);
     ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", orderItem.ProductID);
     return View(orderItem);
 }
Esempio n. 13
0
 public ActionResult Edit([Bind(Include = "OrderID,MemberID,Status,OrderDate,FulfillmentDate,AddressID")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MemberID  = new SelectList(db.Members, "MemberID", "UserName", order.MemberID);
     ViewBag.AddressID = new SelectList(db.Addresses, "AddressID", "Address1", order.AddressID);
     return(View(order));
 }
Esempio n. 14
0
 public ActionResult Edit([Bind(Include = "Id,CustomerId,OrderDate,Status")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Name", order.CustomerId);
     ViewBag.CustomerId = new SelectList(db.Customers, "Id", "Name", order.CustomerId);
     return(View(order));
 }
Esempio n. 15
0
 public static void ExcluirProduto(Produto produto)
 {
     try
     {
         using (var ctx = new ECommerceEntities())
         {
             ctx.Entry <Produto>(produto).State = EntityState.Deleted;
             ctx.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw new InvalidOperationException("Produto não pode ser excluído!");
     }
 }
        public ActionResult Edit(Product model)
        {
            var user = (Member)Session["LogonUser"];

            model.AddeDate    = DateTime.Now;
            model.OwnerUserId = user.ID;
            if (model.UnitsInStock > 0)
            {
                model.IsContinued = true;
            }
            model.ImageName       = db.Products.Where(x => x.ID == model.ID).Select(x => x.ImageName).FirstOrDefault();
            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("Index", "Product"));
        }
Esempio n. 17
0
 public static void RemoverCliente(Cliente cliente)
 {
     using (var ctx = new ECommerceEntities())
     {
         try
         {
             ctx.Entry <Cliente>(cliente).State = EntityState.Deleted;
             ctx.SaveChanges();
         }
         catch (Exception)
         {
             //INSERIR TRY NO CONTROLLER E CHAMAR A VIEW
             throw; //FormatException("");
         }
     }
 }
Esempio n. 18
0
 public virtual void Update(T entity)
 {
     dbSet.Attach(entity);
     dataContext.Entry(entity).State = EntityState.Modified;
 }