public virtual ApiUnitDispositionClientRequestModel MapServerResponseToClientRequest(
            ApiUnitDispositionServerResponseModel response)
        {
            var request = new ApiUnitDispositionClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
Ejemplo n.º 2
0
        public virtual ApiUnitDispositionServerResponseModel MapEntityToModel(
            UnitDisposition item)
        {
            var model = new ApiUnitDispositionServerResponseModel();

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

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

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
Ejemplo n.º 4
0
        public void MapEntityToModel()
        {
            var             mapper = new DALUnitDispositionMapper();
            UnitDisposition item   = new UnitDisposition();

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

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

            if (validationResult.IsValid)
            {
                UnitDisposition record = this.DalUnitDispositionMapper.MapModelToEntity(id, model);
                await this.UnitDispositionRepository.Update(record);

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

                ApiUnitDispositionServerResponseModel apiModel = this.DalUnitDispositionMapper.MapEntityToModel(record);
                await this.mediator.Publish(new UnitDispositionUpdatedNotification(apiModel));

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