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 getIpOperation = await _ipbo.ReadAsync(getOperation.Result.InterestPointId); if (!getIpOperation.Success) { return(OperationErrorBackToIndex(getIpOperation.Exception)); } if (getIpOperation.Result == null) { return(RecordNotFound()); } var getROperation = await _rbo.ReadAsync(getOperation.Result.ResultId); if (!getROperation.Success) { return(OperationErrorBackToIndex(getROperation.Exception)); } if (getROperation.Result == null) { return(RecordNotFound()); } var vm = ResultInterestPointViewModel.Parse(getOperation.Result); ViewData["Title"] = "Result Interest Point Details "; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "Details", Controller = "ResultInterestPoints", Icon = "fa-search", Text = "Detail" }); ViewData["InterestPoints"] = InterestPointViewModel.Parse(getIpOperation.Result); ViewData["Results"] = ResultViewModel.Parse(getROperation.Result); ViewData["BreadCrumbs"] = crumbs; return(View(vm)); }
public void TestCreateResultInterestPointAsync() { var ripbo = new ResultInterestPointBusinessObject(); var rbo = new ResultBusinessObject(); var ipbo = new InterestPointBusinessObject(); var vbo = new VisitorBusinessObject(); var qbo = new QuizBusinessObject(); var quiz = new Quiz("Quiz 1"); qbo.Create(quiz); 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("A", "C", DateTime.Now, "M", profile.Id, country.Id); vbo.Create(visitor); var result = new Result("Quiz 1", DateTime.UtcNow, quiz.Id, visitor.Id); var interestPoint = new InterestPoint("Bar do Rui", "Pesticos&Cocktails", "Rua dos Anjos", "C://images", "14h", "00h", "Sabados", true, true, company.Id); rbo.Create(result); ipbo.Create(interestPoint); var _resultInterestPoint = new ResultInterestPoint(result.Id, interestPoint.Id); var resCreate = ripbo.CreateAsync(_resultInterestPoint).Result; var resGet = ripbo.ReadAsync(_resultInterestPoint.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }