public ActionResult Edit([Bind(Include = "Id,Code,CreatedDate,ContactName,ContactAddress,ContactPhone,ContactEmail,ContactReceiverName,ContactReceiverAddress,ContactReceiverPhone,ContactReceiverEmail,Note,TotalPrice")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(order));
 }
 public ActionResult Edit([Bind(Include = "Id,NameCompany,Address,Phone,Email,AddressWeb,AddressSocial")] Contact contact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contact).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contact));
 }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "Id,ImageUrl,Name,Address,Comment")] UserComment userComment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userComment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userComment));
 }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "Id,Code,Title,ImageUrl,Source,Description,CreatedDate")] NewsService newsService)
 {
     if (ModelState.IsValid)
     {
         newsService.CreatedDate     = DateTime.Now;
         db.Entry(newsService).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(newsService));
 }
Beispiel #5
0
        public ActionResult Edit([Bind(Include = "Id,Title,Text")] AboutShop aboutShop)
        {
            if (ModelState.IsValid)
            {
                db.Entry(aboutShop).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aboutShop));
        }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "Id,CategoryId,CategoryName,Code,Name,Price,Unit,ImageUrl,Description,Size,Discount,DisplayPosition,Status,CreatedDate,SortOrder")] Product product)
 {
     if (ModelState.IsValid)
     {
         product.CreatedDate     = DateTime.Now;
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId   = new SelectList(db.Categories, "Id", "Name", product.CategoryId);
     ViewBag.CategoryName = new SelectList(db.Categories, "Name", "Name", product.CategoryName);
     return(View(product));
 }
        public ActionResult Edit([Bind(Include = "Id,ParentId,ParentLevel,Name,SortOrder,Status")] Category category)
        {
            if (ModelState.IsValid)
            {
                if (category.ParentId == 0)
                {
                    category.ParentLevel = 1;
                }
                else
                {
                    category.ParentLevel = 2;
                };
                db.Entry(category).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            // BEGIN: Tạo ra dropdownlist cho trường Status
            var statusItems = new[]
            {
                new { Id = "ACTIVE", Name = "Active" },
                new { Id = "DEACTIVE", Name = "Deactive" },
            };

            ViewBag.Status = new SelectList(statusItems, "Id", "Name");
            // END: Tạo ra dropdownlist cho trường Status

            // BEGIN: Tạo ra dropdownlist cho trường ParentId
            var categories = db.Categories.Where(x => x.ParentId == 0).ToList();
            //var categories = db.Categories.ToList();

            var root = new Category();

            root.Id   = 0;
            root.Name = "Tạo mới";

            categories.Add(root);

            ViewBag.ParentId = new SelectList(categories, "Id", "Name");
            // END: Tạo ra dropdownlist cho trường ParentId

            return(View(category));
        }