Ejemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListAsync();

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

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

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

            var list = new List <FeedbackViewModel>();

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

            var vList = new List <VisitorViewModel>();

            foreach (var item in vListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    vList.Add(VisitorViewModel.Parse(item));
                }
            }

            var ipList = new List <InterestPointViewModel>();

            foreach (var item in ipListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    ipList.Add(InterestPointViewModel.Parse(item));
                }
            }
            ViewData["Title"]       = "Feedbacks";
            ViewData["BreadCrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            ViewBag.Visitors        = vList;
            ViewBag.InterestPoints  = ipList;
            return(View(list));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListAsync();

            if (!listOperation.Success)
            {
                return(OperationErrorBackToIndex(listOperation.Exception));
            }
            var lst = new List <ResultViewModel>();

            foreach (var item in listOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    lst.Add(ResultViewModel.Parse(item));
                }
            }
            var qlistOperation = await _qbo.ListAsync();

            if (!qlistOperation.Success)
            {
                return(OperationErrorBackToIndex(qlistOperation.Exception));
            }
            var quizlst = new List <QuizViewModel>();

            foreach (var item in qlistOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    quizlst.Add(QuizViewModel.Parse(item));
                }
            }
            var vlistOperation = await _vbo.ListAsync();

            if (!vlistOperation.Success)
            {
                return(OperationErrorBackToIndex(vlistOperation.Exception));
            }
            var visitorlst = new List <VisitorViewModel>();

            foreach (var item in vlistOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    visitorlst.Add(VisitorViewModel.Parse(item));
                }
            }

            ViewData["Title"]       = "Results Quiz";
            ViewData["Breadcrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            ViewData["Quizzes"]     = quizlst;
            ViewData["Visitors"]    = visitorlst;
            return(View(lst));
        }
Ejemplo n.º 3
0
        public void TestListVisitorAsync()
        {
            BoraNowSeeder.Seed();
            var vbo     = new VisitorBusinessObject();
            var resList = vbo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Ejemplo n.º 4
0
        public void TestDeleteVisitorAsync()
        {
            BoraNowSeeder.Seed();
            var vbo       = new VisitorBusinessObject();
            var resList   = vbo.List();
            var resDelete = vbo.DeleteAsync(resList.Result.First().Id).Result;

            resList = vbo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
Ejemplo n.º 5
0
        public void TestUpdateVisitorAsync()
        {
            BoraNowSeeder.Seed();
            var vbo     = new VisitorBusinessObject();
            var resList = vbo.List();
            var item    = resList.Result.FirstOrDefault();


            var countrybo = new CountryBusinessObject();
            var pbo       = new ProfileBusinessObject();
            var companybo = new CompanyBusinessObject();

            var country = new Country("Holanda");
            var profile = new Profile("a", "b");
            var company = new Company("a", "b", "c", "d", profile.Id);

            countrybo.Create(country);
            pbo.Create(profile);
            companybo.Create(company);

            var visitor = new Visitor("R", "f", DateTime.Now.AddYears(-24), "F", profile.Id, country.Id);

            item.FirstName = visitor.FirstName;
            item.LastName  = visitor.LastName;
            item.BirthDate = visitor.BirthDate;
            item.Gender    = visitor.Gender;
            item.ProfileId = visitor.ProfileId;
            item.CountryId = visitor.CountryId;

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

            resList = vbo.ListAsync().Result;

            Assert.IsTrue(resUpdate.Success && resList.Success &&
                          resList.Result.First().FirstName == visitor.FirstName && resList.Result.First().LastName == visitor.LastName &&
                          resList.Result.First().BirthDate == visitor.BirthDate && resList.Result.First().Gender == visitor.Gender &&
                          resList.Result.First().ProfileId == visitor.ProfileId &&
                          resList.Result.First().CountryId == visitor.CountryId);
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListAsync();

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

            var pListOperation = await _pbo.ListAsync();

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

            var clistOperation = await _cbo.ListAsync();

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

            var lst = new List <VisitorViewModel>();

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

            var pList = new List <ProfileViewModel>();

            foreach (var item in pListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    pList.Add(ProfileViewModel.Parse(item));
                }
            }

            var clst = new List <CountryViewModel>();

            foreach (var item in clistOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    clst.Add(CountryViewModel.Parse(item));
                }
            }

            ViewBag.Profiles  = pList;
            ViewBag.Countries = clst;

            ViewData["Title"]       = "Visitors";
            ViewData["BreadCrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            ViewData["Countries"]   = clst;

            return(View(lst));
        }