예제 #1
0
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListAsync();

            if (!listOperation.Success)
            {
                return(OperationErrorBackToIndex(listOperation.Exception));
            }
            var ipListOperation = await _ipbo.ListAsync();

            if (!ipListOperation.Success)
            {
                return(OperationErrorBackToIndex(ipListOperation.Exception));
            }
            var rListOperation = await _rbo.ListAsync();

            if (!rListOperation.Success)
            {
                return(OperationErrorBackToIndex(rListOperation.Exception));
            }


            var list = new List <ResultInterestPointViewModel>();

            foreach (var item in listOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    list.Add(ResultInterestPointViewModel.Parse(item));
                }
            }

            var ipList = new List <InterestPointViewModel>();

            foreach (var item in ipListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    ipList.Add(InterestPointViewModel.Parse(item));
                }
            }
            var rList = new List <ResultViewModel>();

            foreach (var item in rListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    rList.Add(ResultViewModel.Parse(item));
                }
            }

            ViewData["Title"]       = "Result Interest Point  ";
            ViewData["BreadCrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            ViewBag.InterestPoints  = ipList;
            ViewBag.Results         = rList;
            return(View(list));
        }
예제 #2
0
        public void TestListInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var bo      = new InterestPointBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
예제 #3
0
        public void TestDeleteInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var bo        = new InterestPointBusinessObject();
            var resList   = bo.List();
            var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result;

            resList = bo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
예제 #4
0
        public void TestUpdateInterestPointAsync()
        {
            BoraNowSeeder.Seed();

            var ipbo    = new InterestPointBusinessObject();
            var resList = ipbo.List();
            var item    = resList.Result.FirstOrDefault();

            var cbo = new CompanyBusinessObject();
            var pbo = new ProfileBusinessObject();

            var profile = new Profile("II", "AA");

            pbo.Create(profile);

            var company = new Company("kfc", "you", "9111222", "11111", profile.Id);

            cbo.Create(company);

            var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id);

            item.Name         = interestPoint.Name;
            item.Address      = interestPoint.Address;
            item.ClosingDays  = interestPoint.ClosingDays;
            item.ClosingHours = interestPoint.ClosingHours;
            item.Description  = interestPoint.Description;
            item.OpeningHours = interestPoint.OpeningHours;
            item.PhotoPath    = interestPoint.PhotoPath;
            item.CovidSafe    = interestPoint.CovidSafe;
            item.Status       = interestPoint.Status;
            item.CompanyId    = interestPoint.CompanyId;

            var resUpdate = ipbo.UpdateAsync(item).Result;

            resList = ipbo.ListAsync().Result;

            Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Name == interestPoint.Name &&
                          resList.Result.First().Address == interestPoint.Address &&
                          resList.Result.First().ClosingHours == interestPoint.ClosingHours &&
                          resList.Result.First().Description == interestPoint.Description &&
                          resList.Result.First().ClosingDays == interestPoint.ClosingDays &&
                          resList.Result.First().OpeningHours == interestPoint.OpeningHours &&
                          resList.Result.First().PhotoPath == interestPoint.PhotoPath &&
                          resList.Result.First().CovidSafe == interestPoint.CovidSafe &&
                          resList.Result.First().Status == interestPoint.Status &&
                          resList.Result.First().CompanyId == interestPoint.CompanyId);
        }
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListAsync();

            if (!listOperation.Success)
            {
                return(OperationErrorBackToIndex(listOperation.Exception));
            }
            var cListOperation = await _cbo.ListAsync();

            if (!cListOperation.Success)
            {
                return(OperationErrorBackToIndex(cListOperation.Exception));
            }

            var list = new List <InterestPointViewModel>();

            foreach (var item in listOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    list.Add(InterestPointViewModel.Parse(item));
                }
            }

            var cList = new List <CompanyViewModel>();

            foreach (var item in cListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    cList.Add(CompanyViewModel.Parse(item));
                }
            }

            ViewData["Title"]       = "Interest Points";
            ViewData["BreadCrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            ViewBag.Companies       = cList;
            return(View(list));
        }