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 getServiceOperation = await _serviceBO.ReadAsync(getOperation.Result.ServiceId); if (!getServiceOperation.Success) { return(OperationErrorBackToIndex(getServiceOperation.Exception)); } if (getServiceOperation.Result == null) { return(RecordNotFound()); } var vm = ServiceProvidedVM.Parse(getOperation.Result); var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "Details", Controller = "ServicesProvided", Icon = "fa-info-circle", Text = "Details" }); ViewData["Title"] = "Service provided details"; ViewData["BreadCrumbs"] = crumbs; ViewData["Service"] = ServiceVM.Parse(getServiceOperation.Result); return(View(vm)); }
public void TestCreateAndListServiceProvidedAsync() { ApplicationSeeder.Seed(); var bo = new ServiceProvidedBO(); var foreignBO = new ServiceBO(); var serviceProvided = new ServiceProvided(foreignBO.ListUndeleted().Result.First().Id); var resCreate = bo.CreateAsync(serviceProvided).Result; var resGet = bo.ReadAsync(serviceProvided.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }