Example #1
0
        public async Task <ActionResult> Edit([Bind(Include = "id,name")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Entry(category).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(category));
        }
        public async Task <ActionResult> Edit([Bind(Include = "id,name,catid,imageurl,price,isactive,description")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Entry(product).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.catid = new SelectList(db.Category, "id", "name", product.catid);
            return(View(product));
        }