Exemplo n.º 1
0
        //
        // GET: /Calories/
        /* -- Show Default View -- */
        public ActionResult Index()
        {
            var db = new CaloriesDataContext();
            var Mealz = db.Meals.ToArray();

            return View(Mealz);
        }
Exemplo n.º 2
0
        public ActionResult DeleteMeal(long Id)
        {
            var db = new CaloriesDataContext();
            var Meal = db.Meals.Find(Id);

            return View(Meal);
        }
Exemplo n.º 3
0
        public ActionResult MealEdit(long Id)
        {
            var db = new CaloriesDataContext();
            var Mealz = db.Meals.Find(Id);
            var categoryList = new SelectList(new[] { "Breakfast", "Lunch", "Dinner", "Snack" });
            ViewBag.CategoryList = categoryList;

            return View(Mealz);
        }
Exemplo n.º 4
0
        public ActionResult DeleteMealPost(long Id)
        {
            var db = new CaloriesDataContext();
            var Meal = db.Meals.Find(Id);
            db.Meals.Remove(Meal);
            db.SaveChanges();

            return RedirectToAction("Index");
        }
Exemplo n.º 5
0
 public ActionResult Index()
 {
     var db = new CaloriesDataContext();
     if (db.Sides.Count() >= 0)
     {
         var Sidez = db.Sides.ToArray();
         return View(Sidez);
     }
     return View();
 }
Exemplo n.º 6
0
        public ActionResult Create(Models.sidedishs Side)
        {
            if (ModelState.IsValid)
            {
                var db = new CaloriesDataContext();
                db.Sides.Add(Side);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View();
        }
Exemplo n.º 7
0
        public ActionResult Create(Models.calcount caloriez)
        {
            var categoryList = new SelectList(new[] { "Breakfast", "Lunch", "Dinner", "Snack" });
            ViewBag.CategoryList = categoryList;

            if (ModelState.IsValid)
            {
                var db = new CaloriesDataContext();
                db.Meals.Add(caloriez);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View();
        }
Exemplo n.º 8
0
        public ActionResult MealEditPost(long Id)
        {
            var db = new CaloriesDataContext();
            var Meal = db.Meals.Find(Id);
            UpdateModel(Meal);
            db.SaveChanges();

            return RedirectToAction("Index");
        }