public virtual ApiVehicleCapabilitiesServerResponseModel MapEntityToModel(
            VehicleCapabilities item)
        {
            var model = new ApiVehicleCapabilitiesServerResponseModel();

            model.SetProperties(item.Id,
                                item.VehicleCapabilityId,
                                item.VehicleId);
            if (item.VehicleCapabilityIdNavigation != null)
            {
                var vehicleCapabilityIdModel = new ApiVehCapabilityServerResponseModel();
                vehicleCapabilityIdModel.SetProperties(
                    item.VehicleCapabilityIdNavigation.Id,
                    item.VehicleCapabilityIdNavigation.Name);

                model.SetVehicleCapabilityIdNavigation(vehicleCapabilityIdModel);
            }

            if (item.VehicleIdNavigation != null)
            {
                var vehicleIdModel = new ApiVehicleServerResponseModel();
                vehicleIdModel.SetProperties(
                    item.VehicleIdNavigation.Id,
                    item.VehicleIdNavigation.Name);

                model.SetVehicleIdNavigation(vehicleIdModel);
            }

            return(model);
        }
        public virtual ApiVehCapabilityClientRequestModel MapServerResponseToClientRequest(
            ApiVehCapabilityServerResponseModel response)
        {
            var request = new ApiVehCapabilityClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
Ejemplo n.º 3
0
        public virtual ApiVehCapabilityServerResponseModel MapEntityToModel(
            VehCapability item)
        {
            var model = new ApiVehCapabilityServerResponseModel();

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

            return(model);
        }
        public virtual ApiVehCapabilityServerResponseModel MapServerRequestToResponse(
            int id,
            ApiVehCapabilityServerRequestModel request)
        {
            var response = new ApiVehCapabilityServerResponseModel();

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
        public void MapEntityToModel()
        {
            var           mapper = new DALVehCapabilityMapper();
            VehCapability item   = new VehCapability();

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

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Ejemplo n.º 6
0
        public virtual async Task <UpdateResponse <ApiVehCapabilityServerResponseModel> > Update(
            int id,
            ApiVehCapabilityServerRequestModel model)
        {
            var validationResult = await this.VehCapabilityModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                VehCapability record = this.DalVehCapabilityMapper.MapModelToEntity(id, model);
                await this.VehCapabilityRepository.Update(record);

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

                ApiVehCapabilityServerResponseModel apiModel = this.DalVehCapabilityMapper.MapEntityToModel(record);
                await this.mediator.Publish(new VehCapabilityUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiVehCapabilityServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiVehCapabilityServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Ejemplo n.º 7
0
 public VehCapabilityUpdatedNotification(ApiVehCapabilityServerResponseModel record)
 {
     this.Record = record;
 }
 public void SetVehicleCapabilityIdNavigation(ApiVehCapabilityServerResponseModel value)
 {
     this.VehicleCapabilityIdNavigation = value;
 }