public async Task <IActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(RecordNotFound());
            }
            var getOperation = await _bo.ReadAsync((Guid)id);

            if (!getOperation.Success)
            {
                return(OperationErrorBackToIndex(getOperation.Exception));
            }
            if (getOperation.Result == null)
            {
                return(RecordNotFound());
            }

            var getCOperation = await _cbo.ReadAsync(getOperation.Result.CompanyId);

            if (!getCOperation.Success)
            {
                return(OperationErrorBackToIndex(getCOperation.Exception));
            }
            if (getCOperation.Result == null)
            {
                return(RecordNotFound());
            }

            var vm = InterestPointViewModel.Parse(getOperation.Result);

            ViewData["Title"] = "Interest Point Details";

            var crumbs = GetCrumbs();

            crumbs.Add(new BreadCrumb()
            {
                Action = "New", Controller = "InterestPoints", Icon = "fa-search", Text = "Detail"
            });

            ViewData["Companies"]   = CompanyViewModel.Parse(getCOperation.Result);
            ViewData["BreadCrumbs"] = crumbs;
            return(View(vm));
        }
예제 #2
0
        public void TestCreateInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var ipbo = new InterestPointBusinessObject();
            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);

            var resCreate = ipbo.CreateAsync(interestPoint).Result;
            var resGet    = ipbo.ReadAsync(interestPoint.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }