Пример #1
0
        public void TestDeleteProposalAsync()
        {
            ApplicationSeeder.Seed();

            var bo = new ProposalBO();

            var resList = bo.ListAsync().Result;
            var total   = resList.Result.Count;

            var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result;

            var list = bo.ListUndeletedAsync().Result;

            Assert.IsTrue(resDelete.Success && resList.Success && list.Result.Count == (total - 1));
        }
Пример #2
0
        public void TestUpdateProposalAsync()
        {
            ApplicationSeeder.Seed();

            var bo = new ProposalBO();

            var resList = bo.ListAsync().Result;

            var item = resList.Result.FirstOrDefault();

            item.Message = "Oi";

            var resUpdate = bo.UpdateAsync(item).Result;

            var list = bo.ListUndeletedAsync().Result;

            Assert.IsTrue(resList.Success && resUpdate.Success && list.Result.First().Message == "Oi");
        }
Пример #3
0
        public async Task <IActionResult> ListAsync()
        {
            var listResult = await _bo.ListUndeletedAsync();

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

            var list      = listResult.Result;
            var finalList = new List <ProposalVM>();

            foreach (var item in list)
            {
                var vm = ProposalVM.Parse(item);
                finalList.Add(vm);
            }

            return(Ok(finalList));
        }
Пример #4
0
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListUndeletedAsync();

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

            var finalList = new List <ProposalVM>();

            foreach (var item in listOperation.Result)
            {
                finalList.Add(ProposalVM.Parse(item));
            }

            var jobList = await GetJobViewModels(listOperation.Result.Select(x => x.JobId).Distinct().ToList());

            ViewData["Title"]       = "Proposals";
            ViewData["Jobs"]        = jobList;
            ViewData["BreadCrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            return(View(finalList));
        }