示例#1
0
        /// <summary>
        /// Gets All contract lisiting
        /// </summary>
        /// <returns>List of contracts</returns>
        public async Task <BaseResult <List <ContractListingViewModel> > > GetAllContracts()
        {
            BaseResult <List <ContractOverview> > allContractList = new BaseResult <List <ContractOverview> >();
            DynamicParameters paramCollection = new DynamicParameters();

            allContractList = await iContractListing.ExecuteStoredProcedure(Constants.StoredProcedure.GetAllContracts, paramCollection);

            if (allContractList.IsError || allContractList.ExceptionMessage != null)
            {
                BaseResult <List <ContractListingViewModel> > baseResult = new BaseResult <List <ContractListingViewModel> >
                {
                    IsError          = true,
                    ExceptionMessage = allContractList.ExceptionMessage
                };
                return(baseResult);
            }
            else
            {
                BaseResult <List <ContractListingViewModel> > baseResult = ContractsResponseMapper.MapContractListingResponse(allContractList);
                if (allContractList.ExceptionMessage != null)
                {
                    baseResult.IsError          = true;
                    baseResult.ExceptionMessage = allContractList.ExceptionMessage;
                    return(baseResult);
                }
                else
                {
                    return(baseResult);
                }
            }
        }