Example #1
0
        // GET: FOOD_ITEM/Create/RestaurantID
        public ActionResult Create(int?id)
        {
            if (id != null && User.Identity.IsAuthenticated && db.Restaurants.Find(id).USER_ID == User.Identity.GetUserId())
            {
                FOOD_ITEM newFood = new FOOD_ITEM();
                ViewBag.RestaurantName = db.Restaurants.Find(id).RESTAURANT_NAME;
                newFood.RESTAURANT_ID  = id.Value;
                ViewBag.yn             = new SelectList(
                    new List <SelectListItem>
                {
                    new SelectListItem {
                        Text = "No", Value = "N", Selected = true
                    },
                    new SelectListItem {
                        Text = "Yes", Value = "Y", Selected = false
                    },
                }, "Value", "Text");
                ViewBag.CUSINES = new SelectList(db.CUSINEs, "CUSINE", "CUSINE");


                return(View(newFood));
            }
            else
            {
                return(HttpNotFound());
            }
        }
Example #2
0
        // GET: FOOD_ITEM/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FOOD_ITEM fOOD_ITEM = db.FOOD_ITEM.Find(id);

            if (fOOD_ITEM == null)
            {
                return(HttpNotFound());
            }
            ViewBag.yn = new SelectList(
                new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "No", Value = "N", Selected = true
                },
                new SelectListItem {
                    Text = "Yes", Value = "Y", Selected = false
                },
            }, "Value", "Text");
            ViewBag.CUSINES = new SelectList(db.CUSINEs, "CUSINE", "CUSINE");
            return(View(fOOD_ITEM));
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            FOOD_ITEM fOOD_ITEM = db.FOOD_ITEM.Find(id);

            db.FOOD_ITEM.Remove(fOOD_ITEM);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "ITEM_ID,RESTAURANT_ID,ITEM_NAME,DESCRIPTION,CUISINE,ENERGY,PRICE,IS_DRINK,IS_PURE_VEGI,HAS_BEEF,HAS_PORK,HAS_OTHERMEAT,HAS_CHICKEN,HAS_EGG,HAS_MILK,HAS_NUTS,HAS_VEGI,HAS_FRUIT,HAS_RICE")] FOOD_ITEM fOOD_ITEM)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fOOD_ITEM).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RESTAURANT_ID = new SelectList(db.Restaurants, "RESTAURANT_ID", "RESTAURANT_NAME", fOOD_ITEM.RESTAURANT_ID);
     return(View(fOOD_ITEM));
 }
Example #5
0
        // GET: FOOD_ITEM/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FOOD_ITEM fOOD_ITEM = db.FOOD_ITEM.Find(id);

            if (fOOD_ITEM == null)
            {
                return(HttpNotFound());
            }
            return(View(fOOD_ITEM));
        }
Example #6
0
        public ActionResult Create([Bind(Include = "ITEM_ID,RESTAURANT_ID,ITEM_NAME,DESCRIPTION,CUISINE,ENERGY,PRICE,IS_DRINK,IS_PURE_VEGI,HAS_BEEF,HAS_PORK,HAS_OTHERMEAT,HAS_CHICKEN,HAS_EGG,HAS_MILK,HAS_NUTS,HAS_VEGI,HAS_FRUIT,HAS_RICE")] FOOD_ITEM fOOD_ITEM)
        {
            if (ModelState.IsValid)
            {
                db.FOOD_ITEM.Add(fOOD_ITEM);
                db.SaveChanges();
                return(RedirectToAction("Index/" + fOOD_ITEM.RESTAURANT_ID));
            }

            ViewBag.yn = new SelectList(
                new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Yes", Value = "Y", Selected = false
                },
                new SelectListItem {
                    Text = "No", Value = "N", Selected = true
                },
            }, "Value", "Text");
            ViewBag.CUSINES = new SelectList(db.CUSINEs, "CUSINE", "CUSINE");

            return(View(fOOD_ITEM));
        }