Beispiel #1
0
        public async Task <ActionResult> DetailsForAdmin(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(new HttpNotFoundResult());
            }

            var admin = participantsProcessor.GetAdminById(id);

            if (admin == null)
            {
                return(new HttpNotFoundResult());
            }

            var adminParticipantModel = participantsProcessor.AdminDomainToVM(admin);

            (var success, var message, var contratList) = await contractsProcessor.GetAllForAdmin(adminParticipantModel);

            var vm = new DetailsForAdminViewModel
            {
                AdminParticipant = new AdminParticipantCreateEditViewModel
                {
                    Login = AdminToLoginVM(admin)
                },
                ContractList = contratList ?? new List <RentContractDataViewModel>()
            };

            return(View(vm));
        }
Beispiel #2
0
        private async Task <RentContractModel> GetByIdAsync(string ID)
        {
            RentContractModel contract = null;
            var domainContract         = contractsRepo.SearchFor(x => x.Id == ID).FirstOrDefault();

            if (domainContract != null)
            {
                (var success, var message, var contractResponse) = await bcContracts.GetById(ID);

                contract = new RentContractModel
                {
                    ID = contractResponse.contractId,
                    contractProvider = participantsProcessor.AdminDomainToApiModel(participantsProcessor.GetAdminById(contractResponse.GetIDFromAttributedID(contractResponse.contractProvider))),
                    contractClient   = participantsProcessor.ClientDomainToApiModel(participantsProcessor.GetClientById(contractResponse.GetIDFromAttributedID(contractResponse.contractClient))),
                    expiryDate       = contractResponse.expiryDate,
                    durationDays     = contractResponse.durationDays,
                    status           = contractResponse.status,
                    content          = contractResponse.content
                };
            }

            return(contract);
        }