public virtual ApiIncludedColumnTestClientRequestModel MapServerResponseToClientRequest(
            ApiIncludedColumnTestServerResponseModel response)
        {
            var request = new ApiIncludedColumnTestClientRequestModel();

            request.SetProperties(
                response.Name,
                response.Name2);
            return(request);
        }
        public virtual ApiIncludedColumnTestServerResponseModel MapServerRequestToResponse(
            int id,
            ApiIncludedColumnTestServerRequestModel request)
        {
            var response = new ApiIncludedColumnTestServerResponseModel();

            response.SetProperties(id,
                                   request.Name,
                                   request.Name2);
            return(response);
        }
Ejemplo n.º 3
0
        public virtual ApiIncludedColumnTestServerResponseModel MapEntityToModel(
            IncludedColumnTest item)
        {
            var model = new ApiIncludedColumnTestServerResponseModel();

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

            return(model);
        }
        public void MapEntityToModel()
        {
            var mapper = new DALIncludedColumnTestMapper();
            IncludedColumnTest item = new IncludedColumnTest();

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

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
            response.Name2.Should().Be("A");
        }
        public virtual async Task <UpdateResponse <ApiIncludedColumnTestServerResponseModel> > Update(
            int id,
            ApiIncludedColumnTestServerRequestModel model)
        {
            var validationResult = await this.IncludedColumnTestModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                IncludedColumnTest record = this.DalIncludedColumnTestMapper.MapModelToEntity(id, model);
                await this.IncludedColumnTestRepository.Update(record);

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

                ApiIncludedColumnTestServerResponseModel apiModel = this.DalIncludedColumnTestMapper.MapEntityToModel(record);
                await this.mediator.Publish(new IncludedColumnTestUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiIncludedColumnTestServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiIncludedColumnTestServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Ejemplo n.º 6
0
 public IncludedColumnTestUpdatedNotification(ApiIncludedColumnTestServerResponseModel record)
 {
     this.Record = record;
 }