コード例 #1
0
        public virtual ApiCallTypeClientRequestModel MapServerResponseToClientRequest(
            ApiCallTypeServerResponseModel response)
        {
            var request = new ApiCallTypeClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
コード例 #2
0
        public virtual ApiCallTypeServerResponseModel MapEntityToModel(
            CallType item)
        {
            var model = new ApiCallTypeServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name);

            return(model);
        }
コード例 #3
0
        public virtual ApiCallTypeServerResponseModel MapServerRequestToResponse(
            int id,
            ApiCallTypeServerRequestModel request)
        {
            var response = new ApiCallTypeServerResponseModel();

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
コード例 #4
0
        public void MapEntityToModel()
        {
            var      mapper = new DALCallTypeMapper();
            CallType item   = new CallType();

            item.SetProperties(1, "A");
            ApiCallTypeServerResponseModel response = mapper.MapEntityToModel(item);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
コード例 #5
0
ファイル: CallTypeService.cs プロジェクト: codenesium/samples
        public virtual async Task <UpdateResponse <ApiCallTypeServerResponseModel> > Update(
            int id,
            ApiCallTypeServerRequestModel model)
        {
            var validationResult = await this.CallTypeModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                CallType record = this.DalCallTypeMapper.MapModelToEntity(id, model);
                await this.CallTypeRepository.Update(record);

                record = await this.CallTypeRepository.Get(id);

                ApiCallTypeServerResponseModel apiModel = this.DalCallTypeMapper.MapEntityToModel(record);
                await this.mediator.Publish(new CallTypeUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiCallTypeServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiCallTypeServerResponseModel> .UpdateResponse(validationResult));
            }
        }
コード例 #6
0
ファイル: CallTypeHandler.cs プロジェクト: codenesium/samples
 public CallTypeUpdatedNotification(ApiCallTypeServerResponseModel record)
 {
     this.Record = record;
 }
コード例 #7
0
ファイル: DALCallMapper.cs プロジェクト: codenesium/samples
        public virtual ApiCallServerResponseModel MapEntityToModel(
            Call item)
        {
            var model = new ApiCallServerResponseModel();

            model.SetProperties(item.Id,
                                item.AddressId,
                                item.CallDispositionId,
                                item.CallStatusId,
                                item.CallString,
                                item.CallTypeId,
                                item.DateCleared,
                                item.DateCreated,
                                item.DateDispatched,
                                item.QuickCallNumber);
            if (item.AddressIdNavigation != null)
            {
                var addressIdModel = new ApiAddressServerResponseModel();
                addressIdModel.SetProperties(
                    item.AddressIdNavigation.Id,
                    item.AddressIdNavigation.Address1,
                    item.AddressIdNavigation.Address2,
                    item.AddressIdNavigation.City,
                    item.AddressIdNavigation.State,
                    item.AddressIdNavigation.Zip);

                model.SetAddressIdNavigation(addressIdModel);
            }

            if (item.CallDispositionIdNavigation != null)
            {
                var callDispositionIdModel = new ApiCallDispositionServerResponseModel();
                callDispositionIdModel.SetProperties(
                    item.CallDispositionIdNavigation.Id,
                    item.CallDispositionIdNavigation.Name);

                model.SetCallDispositionIdNavigation(callDispositionIdModel);
            }

            if (item.CallStatusIdNavigation != null)
            {
                var callStatusIdModel = new ApiCallStatusServerResponseModel();
                callStatusIdModel.SetProperties(
                    item.CallStatusIdNavigation.Id,
                    item.CallStatusIdNavigation.Name);

                model.SetCallStatusIdNavigation(callStatusIdModel);
            }

            if (item.CallTypeIdNavigation != null)
            {
                var callTypeIdModel = new ApiCallTypeServerResponseModel();
                callTypeIdModel.SetProperties(
                    item.CallTypeIdNavigation.Id,
                    item.CallTypeIdNavigation.Name);

                model.SetCallTypeIdNavigation(callTypeIdModel);
            }

            return(model);
        }
コード例 #8
0
 public void SetCallTypeIdNavigation(ApiCallTypeServerResponseModel value)
 {
     this.CallTypeIdNavigation = value;
 }