示例#1
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Alias,Price,PromotionPrice,Warranty,Description,ParentId,DisplayOrder,Image,HomeFlag,CategoryId,CreatedDate,CreatedBy,UpdatedDate,UpdatedBy,MetaKeyword,MetaDescription,Status")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Entry(product).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CategoryId = new SelectList(db.ProductCategories, "Id", "Name", product.CategoryId);
            return(View(product));
        }
示例#2
0
 public virtual void Update(T entity)
 {
     dbSet.Attach(entity);
     dataContext.Entry(entity).State = EntityState.Modified;
 }