Пример #1
0
        public ActionResult AddMeal(MealModel model)
        {
            string UserName = (string)Session["UserName"];

            if (ModelState.IsValid)
            {
                int id = mealInformation.AddMeal(model, UserName);
                if (id > 0)
                {
                    ViewBag.Success = "Meal Added";
                    ModelState.Clear();
                }
                else if (id == -1)
                {
                    ViewBag.Success = "Time Is Over";
                }
                else if (id == -3)
                {
                    ViewBag.Success = "You already added meal You can just update it";
                }
                else if (id == -2)
                {
                    ViewBag.Success = "Insufficient Balance!";
                }
            }
            return(View());
        }
Пример #2
0
        public ActionResult Meals(MealModel model)
        {
            string UserName = (string)(Session["UserName"]);

            if (ModelState.IsValid)
            {
                int id = mealInformation.AddMeal(model, UserName);
                if (id > 0)
                {
                    ModelState.Clear();
                    ViewBag.Success = "Data inserted";
                }
            }
            return(View());
        }