コード例 #1
0
        public async Task <ActionResult> DetailsForClient(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(new HttpNotFoundResult());
            }

            var client = participantsProcessor.GetClientById(id);

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

            var clientParticipantModel = participantsProcessor.ClientDomainToVM(client);

            (var success, var message, var contratList) = await contractsProcessor.GetAllForClient(clientParticipantModel);

            var vm = new DetailsForClientViewModel
            {
                ClientParticipant = new ClientParticipantCreateEditViewModel
                {
                    Login = ClientToLoginVM(client)
                },
                ContractList = contratList ?? new List <RentContractDataViewModel>()
            };

            return(View(vm));
        }
コード例 #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);
        }