Exemple #1
0
 public ActionResult Edit([Bind(Include = "ID,Name,Active")] NewsType newsType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(newsType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(newsType));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Images")] Producer producer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(producer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(producer));
 }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "ID,Username,Password,Fullname,Birthday,Sex,PhoneNumber,Email,Address,Permission,Active")] Account account)
 {
     if (ModelState.IsValid)
     {
         db.Entry(account).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(account));
 }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "ID,Name")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "ID,Title,IsPublic,Content,Author,CreatedDate,NewsTypeID")] New @new)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@new).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.NewsTypeID = new SelectList(db.NewType, "ID", "Name", @new.NewsTypeID);
     return(View(@new));
 }
 public ActionResult Edit([Bind(Include = "ID,Discount,Begin,End,ProductID")] Sale sale)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sale).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID = new SelectList(db.Product, "ID", "Name", sale.ProductID);
     return(View(sale));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,ProducerID,CategoryID,Price,IMG,Quantity,Description,TopHot,NewProduct,Active")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryID = new SelectList(db.Category, "ID", "Name", product.CategoryID);
     ViewBag.ProducerID = new SelectList(db.Producer, "ID", "Name", product.ProducerID);
     return(View(product));
 }
 //[ValidateAntiForgeryToken]
 public ActionResult Edit(FormCollection formcollection)
 {
     if (ModelState.IsValid)
     {
         var lstID = formcollection["ID"].ToString().Split(new char[] { ',' });
         foreach (var id in lstID)
         {
             var bill = db.Bill.Find(int.Parse(id));
             if (bill.Status == "Đã hủy")
             {
                 ViewBag.Errorstatus = "Không thể chuyển từ đã hủy sang trạng thái khác";
                 return(RedirectToAction("Index"));
             }
             bill.Status          = formcollection["Status"];
             db.Entry(bill).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     //ViewBag.AccountID = new SelectList(db.Account, "ID", "Username", bill.AccountID);
     return(RedirectToAction("Index"));
 }