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 getJobOperation = await _jobBO.ReadAsync(getOperation.Result.JobId);

            if (!getJobOperation.Success)
            {
                return(OperationErrorBackToIndex(getJobOperation.Exception));
            }

            if (getJobOperation.Result == null)
            {
                return(RecordNotFound());
            }

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

            var crumbs = GetCrumbs();

            crumbs.Add(new BreadCrumb()
            {
                Action = "Details", Controller = "Proposals", Icon = "fa-info-circle", Text = "Details"
            });

            ViewData["Title"]       = "Proposal details";
            ViewData["BreadCrumbs"] = crumbs;
            ViewData["Job"]         = JobVM.Parse(getJobOperation.Result);
            return(View(vm));
        }
        public async Task <IActionResult> GetAsync(Guid id)
        {
            var getResult = await _bo.ReadAsync(id);

            if (!getResult.Success)
            {
                return(InternalServerError(getResult.Exception));
            }

            var item = getResult.Result;

            if (item == null)
            {
                return(NotFound());
            }

            var vm = ProposalVM.Parse(item);

            return(Ok(vm));
        }
        public void TestCreateAndListProposalAsync()
        {
            ApplicationSeeder.Seed();

            var bo        = new ProposalBO();
            var foreignBO = new JobBO();

            var proposal = new Proposal("User Teste", "Mensagem de teste", foreignBO.ListUndeleted().Result.First().Id);

            var resCreate = bo.CreateAsync(proposal).Result;
            var resGet    = bo.ReadAsync(proposal.Id).Result;

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