예제 #1
0
        public void TestListInterestPointNewsletterAsync()
        {
            BoraNowSeeder.Seed();
            var ipnbo   = new InterestPointNewsletterBusinessObject();
            var resList = ipnbo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListAsync();

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

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

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

            var list = new List <InterestPointNewsletterViewModel>();

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

            var nList = new List <NewsletterViewModel>();

            foreach (var item in nListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    nList.Add(NewsletterViewModel.Parse(item));
                }
            }

            var ipList = new List <InterestPointViewModel>();

            foreach (var item in ipListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    ipList.Add(InterestPointViewModel.Parse(item));
                }
            }
            ViewData["Title"]       = "Interest Point Newsletter";
            ViewData["BreadCrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            ViewBag.Newsletters     = nList;
            ViewBag.InterestPoints  = ipList;
            return(View(list));
        }
예제 #3
0
        public void TestDeleteInterestPointNewsletterAsync()
        {
            BoraNowSeeder.Seed();
            var ipnbo     = new InterestPointNewsletterBusinessObject();
            var resList   = ipnbo.List();
            var resDelete = ipnbo.DeleteAsync(resList.Result.First().Id).Result;

            resList = ipnbo.ListAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
예제 #4
0
        public void TestUpdateInterestPointNewsletterAsync()
        {
            BoraNowSeeder.Seed();
            var ipnbo   = new InterestPointNewsletterBusinessObject();
            var resList = ipnbo.List();
            var item    = resList.Result.FirstOrDefault();

            var nbo  = new NewsletterBusinessObject();
            var cbo  = new CompanyBusinessObject();
            var ipbo = new InterestPointBusinessObject();
            var pbo  = new ProfileBusinessObject();

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

            pbo.Create(profile);

            var news          = new Newsletter("New in town, this doughnut place is nuts", "New in town");
            var company       = new Company("a", "b", "c", "123333", profile.Id);
            var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id);

            nbo.Create(news);
            cbo.Create(company);
            ipbo.Create(interestPoint);

            var newInterestPointNews = new InterestPointNewsletter(interestPoint.Id, news.Id);

            item.InterestPointId = newInterestPointNews.InterestPointId;
            item.NewsLetterId    = newInterestPointNews.NewsLetterId;

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

            resList = ipnbo.ListAsync().Result;

            Assert.IsTrue(resUpdate.Success && resList.Success &&
                          resList.Result.First().InterestPointId == newInterestPointNews.InterestPointId && resList.Result.First().NewsLetterId == newInterestPointNews.NewsLetterId);
        }