Ejemplo n.º 1
0
        public ActionResult ItemEdit(Models.ViewItemEditModel item)
        {
            Items x = (from y in context.Items where y.id == item.MyItems.id select y).FirstOrDefault();

            if (x != null)
            {
                x.catid       = item.MyItems.catid;
                x.description = item.MyItems.description;
                x.imageurl    = item.MyItems.imageurl;
                x.isactive    = item.MyItems.isactive;
                x.name        = item.MyItems.name;
                x.price       = item.MyItems.price;
                context.SaveChanges();
            }
            return(RedirectToAction("ItemList"));
        }
Ejemplo n.º 2
0
        public ActionResult ItemEdit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Items item = context.Items.Find(id);

            if (item == null)
            {
                return(HttpNotFound());
            }

            List <CategoriesChild_Result> category = context.Database.SqlQuery <CategoriesChild_Result>("CategoriesChild").ToList();

            Models.ViewItemEditModel x = new Models.ViewItemEditModel();
            x.MyCategories = context.Database.SqlQuery <CategoriesChild_Result>("CategoriesChild").ToList();
            x.MyItems      = item;

            return(View(x));
        }