Пример #1
0
        public void TestDeleteMealAsync()
        {
            RestaurantSeeder.SeedCountries();
            var bo         = new MealBusinessObject();
            var resList    = bo.ListAsync().Result;
            var resDelete  = bo.DeleteAsync(resList.Result.First().Id).Result;
            var resNotList = bo.ListUnDeletedAsync().Result;

            Assert.IsTrue(resDelete.Success && resNotList.Result.Count == 0);
        }
Пример #2
0
        public void TestUpdateMealAsync()
        {
            RestaurantSeeder.SeedCountries();
            var bo      = new MealBusinessObject();
            var resList = bo.ListAsync().Result;
            var item    = resList.Result.FirstOrDefault();

            item.StartingHours = "20h00";
            var resUpdate  = bo.UpdateAsync(item).Result;
            var resNotList = bo.ListUnDeletedAsync().Result;

            Assert.IsTrue(resUpdate.Success && resNotList.Result.First().StartingHours == "20h00");
        }
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListUnDeletedAsync();

            if (!listOperation.Success)
            {
                return(View("Error", new ErrorViewModel()
                {
                    RequestId = listOperation.Exception.Message
                }));
            }
            var lst = new List <MealViewModel>();

            foreach (var item in listOperation.Result)
            {
                lst.Add(MealViewModel.Parse(item));
            }
            return(View(lst));
        }
Пример #4
0
        public async Task <IActionResult> Index()
        {
            var menuOfTheDay = new MenuOfTheDayViewModel();

            var menuListOperation = await _menubo.ListUnDeletedAsync();

            if (!menuListOperation.Success)
            {
                return(View("Error"));
            }
            if (menuListOperation.Result.Count == 0)
            {
                return(View("Error"));
            }

            var servingListOperation = await _servingbo.ListUnDeletedAsync();

            if (!servingListOperation.Success)
            {
                return(View("Error"));
            }
            if (servingListOperation.Result.Count == 0)
            {
                return(View("Error"));
            }

            var dishListOperation = await _dishbo.ListUnDeletedAsync();

            if (!dishListOperation.Success)
            {
                return(View("Error"));
            }
            if (dishListOperation.Result.Count == 0)
            {
                return(View("Error"));
            }

            var drListOperation = await _drbo.ListUnDeletedAsync();

            if (!drListOperation.Success)
            {
                return(View("Error"));
            }
            if (drListOperation.Result.Count == 0)
            {
                return(View("Error"));
            }

            var mealListOperation = await _mealbo.ListUnDeletedAsync();

            if (!mealListOperation.Success)
            {
                return(View("Error"));
            }
            if (mealListOperation.Result.Count == 0)
            {
                return(View("Error"));
            }

            var courseListOperation = await _coursebo.ListUnDeletedAsync();

            if (!courseListOperation.Success)
            {
                return(View("Error"));
            }
            if (courseListOperation.Result.Count == 0)
            {
                return(View("Error"));
            }
        }