public virtual ApiVPersonClientRequestModel MapServerResponseToClientRequest( ApiVPersonServerResponseModel response) { var request = new ApiVPersonClientRequestModel(); request.SetProperties( response.PersonName); return(request); }
public void MapEntityToModel() { var mapper = new DALVPersonMapper(); VPerson item = new VPerson(); item.SetProperties(1, "A"); ApiVPersonServerResponseModel response = mapper.MapEntityToModel(item); response.PersonId.Should().Be(1); response.PersonName.Should().Be("A"); }
public virtual ApiVPersonServerResponseModel MapServerRequestToResponse( int personId, ApiVPersonServerRequestModel request) { var response = new ApiVPersonServerResponseModel(); response.SetProperties(personId, request.PersonName); return(response); }
public virtual ApiVPersonServerResponseModel MapEntityToModel( VPerson item) { var model = new ApiVPersonServerResponseModel(); model.SetProperties(item.PersonId, item.PersonName); return(model); }
public virtual async Task <UpdateResponse <ApiVPersonServerResponseModel> > Update( int personId, ApiVPersonServerRequestModel model) { var validationResult = await this.VPersonModelValidator.ValidateUpdateAsync(personId, model); if (validationResult.IsValid) { VPerson record = this.DalVPersonMapper.MapModelToEntity(personId, model); await this.VPersonRepository.Update(record); record = await this.VPersonRepository.Get(personId); ApiVPersonServerResponseModel apiModel = this.DalVPersonMapper.MapEntityToModel(record); await this.mediator.Publish(new VPersonUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiVPersonServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiVPersonServerResponseModel> .UpdateResponse(validationResult)); } }
public VPersonUpdatedNotification(ApiVPersonServerResponseModel record) { this.Record = record; }