public async Task <IActionResult> Index() { var listOperation = await _bo.ListAsync(); if (!listOperation.Success) { return(OperationErrorBackToIndex(listOperation.Exception)); } var ipListOperation = await _ipbo.ListAsync(); if (!ipListOperation.Success) { return(OperationErrorBackToIndex(ipListOperation.Exception)); } var cipListOperation = await _cipbo.ListAsync(); if (!cipListOperation.Success) { return(OperationErrorBackToIndex(cipListOperation.Exception)); } var list = new List <InterestPointCategoryInterestPointViewModel>(); foreach (var item in listOperation.Result) { if (!item.IsDeleted) { list.Add(InterestPointCategoryInterestPointViewModel.Parse(item)); } } var ipList = new List <InterestPointViewModel>(); foreach (var item in ipListOperation.Result) { if (!item.IsDeleted) { ipList.Add(InterestPointViewModel.Parse(item)); } } var cipList = new List <CategoryInterestPointViewModel>(); foreach (var item in cipListOperation.Result) { if (!item.IsDeleted) { cipList.Add(CategoryInterestPointViewModel.Parse(item)); } } ViewData["Title"] = "Interest Point Categories - Interest Points "; ViewData["BreadCrumbs"] = GetCrumbs(); ViewData["DeleteHref"] = GetDeleteRef(); ViewBag.InterestPoints = ipList; ViewBag.CategoryInterestPoints = cipList; return(View(list)); }
public void TestListCategoryInterestPointAsync() { BoraNowSeeder.Seed(); var cipbo = new CategoryInterestPointBusinessObject(); var resList = cipbo.ListAsync().Result; Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestDeleteInterestPointCategoryAsync() { BoraNowSeeder.Seed(); var bo = new CategoryInterestPointBusinessObject(); var resList = bo.List(); var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted); }
public void TestUpdateInterestpointCategoryAsync() { BoraNowSeeder.Seed(); var cipbo = new CategoryInterestPointBusinessObject(); var resList = cipbo.List(); var item = resList.Result.FirstOrDefault(); var categoryInterestPoint = new CategoryInterestPoint("C"); item.Name = categoryInterestPoint.Name; var resUpdate = cipbo.UpdateAsync(item).Result; resList = cipbo.ListAsync().Result; Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Name == categoryInterestPoint.Name); }