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 getPOperation = await _pbo.ReadAsync(getOperation.Result.ProfileId); if (!getPOperation.Success) { return(OperationErrorBackToIndex(getPOperation.Exception)); } if (getPOperation.Result == null) { return(RecordNotFound()); } var getCountryOperation = await _cbo.ReadAsync(getOperation.Result.CountryId); if (!getCountryOperation.Success) { return(OperationErrorBackToIndex(getCountryOperation.Exception)); } if (getCountryOperation.Result == null) { return(RecordNotFound()); } var vm = VisitorViewModel.Parse(getOperation.Result); ViewData["Title"] = "Visitor Details"; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "New", Controller = "Visitors", Icon = "fa-search", Text = "Detail" }); ViewData["Profiles"] = ProfileViewModel.Parse(getPOperation.Result); ViewData["Countries"] = CountryViewModel.Parse(getCountryOperation.Result); ViewData["BreadCrumbs"] = crumbs; return(View(vm)); }
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 getVOperation = await _vbo.ReadAsync(getOperation.Result.VisitorId); if (!getVOperation.Success) { return(OperationErrorBackToIndex(getVOperation.Exception)); } if (getVOperation.Result == null) { return(RecordNotFound()); } var vm = FeedbackViewModel.Parse(getOperation.Result); ViewData["Title"] = "Feedbacks details"; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "New", Controller = "Feedbacks", Icon = "fa-search", Text = "Detail" }); ViewData["InterestPoints"] = InterestPointViewModel.Parse(getIPOperation.Result); ViewData["Visitors"] = VisitorViewModel.Parse(getVOperation.Result); ViewData["BreadCrumbs"] = crumbs; return(View(vm)); }
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 getQuizOperation = await _qbo.ReadAsync(getOperation.Result.QuizId); if (!getQuizOperation.Success) { return(OperationErrorBackToIndex(getQuizOperation.Exception)); } if (getQuizOperation.Result == null) { return(RecordNotFound()); } var getVisOperation = await _vbo.ReadAsync(getOperation.Result.VisitorId); if (!getVisOperation.Success) { return(OperationErrorBackToIndex(getVisOperation.Exception)); } if (getVisOperation.Result == null) { return(RecordNotFound()); } var vm = ResultViewModel.Parse(getOperation.Result); ViewData["Title"] = "Result Details"; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "Details", Controller = "Results", Icon = "fa-search", Text = "Detail" }); ViewData["Quizzes"] = QuizViewModel.Parse(getQuizOperation.Result); ViewData["Visitors"] = VisitorViewModel.Parse(getVisOperation.Result); ViewData["BreadCrumbs"] = crumbs; return(View(vm)); }
public void TestCreateVisitorAsync() { BoraNowSeeder.Seed(); var vbo = new VisitorBusinessObject(); 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("m", "f", DateTime.Now.AddYears(-24), "m", profile.Id, country.Id); var resCreate = vbo.CreateAsync(visitor).Result; var restGet = vbo.ReadAsync(visitor.Id).Result; Assert.IsTrue(resCreate.Success && restGet.Success && restGet.Result != null); }