Example #1
0
        public static ContractHotelProperties AutomapperContractHotelProperties(ContractHotelPropertiesViewModel viewModel, string loggedUserName)
        {
            var modelMapped = AutoMapper.Mapper.Map <ContractHotelProperties>(viewModel);

            modelMapped.CreatedBy   = loggedUserName;
            modelMapped.UpdatedBy   = loggedUserName;
            modelMapped.CreatedDate = DateTime.Now.JakartaOffset();
            modelMapped.UpdatedDate = DateTime.Now.JakartaOffset();
            return(modelMapped);
        }
Example #2
0
        /// <summary>
        /// GetContractProperties
        /// </summary>
        /// <param name="contractId"></param>
        /// <returns>Task<BaseResult<List<ContractHotelPropertiesViewModel>>></returns>
        public async Task <BaseResult <List <ContractHotelPropertiesViewModel> > > GetContractProperties(int contractId)
        {
            var result = new BaseResult <List <ContractHotelPropertiesViewModel> >()
            {
                Result = new List <ContractHotelPropertiesViewModel>()
            };

            List <ContractHotelProperties>       hotelList;
            List <ContractRoomProperties>        roomList;
            List <ContractClauseLibraryRelation> clauseList;

            this.GetContractProperties(contractId, out hotelList, out roomList, out clauseList);
            List <ContractHotelPropertiesViewModel> mainList1 = new List <ContractHotelPropertiesViewModel>();
            List <ContractHotelPropertiesViewModel> mainList2 = new List <ContractHotelPropertiesViewModel>();
            List <ContractHotelPropertiesViewModel> mainList3 = new List <ContractHotelPropertiesViewModel>();
            ContractHotelPropertiesViewModel
                mappedHotelList = new ContractHotelPropertiesViewModel()
            {
                FeildIdList = new List <FieldViewModel>()
            },
                mappedRoomList = new ContractHotelPropertiesViewModel()
            {
                FeildIdList = new List <FieldViewModel>()
            },
                mappedClauseLibraryList = new ContractHotelPropertiesViewModel()
            {
                FeildIdList = new List <FieldViewModel>()
            };

            foreach (var item in hotelList)
            {
                var model = new FieldViewModel();
                model.Id = item.FieldId;
                mappedHotelList.FeildIdList.Add(model);
            }
            mappedHotelList.Name = "HotelList";
            mainList1.Add(mappedHotelList);


            foreach (var item in roomList)
            {
                var model = new FieldViewModel();
                model.Id = item.FieldId;
                mappedRoomList.FeildIdList.Add(model);
            }
            mappedRoomList.Name = "mappedRoomList";
            mainList2.Add(mappedRoomList);

            foreach (var item in clauseList)
            {
                var model = new FieldViewModel();
                model.ClauseLibraryId = item.ClauseLibraryId;
                mappedClauseLibraryList.FeildIdList.Add(model);
            }
            mappedClauseLibraryList.Name = "mappedClauseLibraryList";
            mainList3.Add(mappedClauseLibraryList);
            result.Result.AddRange(mainList1);
            result.Result.AddRange(mainList2);
            result.Result.AddRange(mainList3);

            return(result);
        }