public virtual ApiSelfReferenceServerResponseModel MapEntityToModel( SelfReference item) { var model = new ApiSelfReferenceServerResponseModel(); model.SetProperties(item.Id, item.SelfReferenceId, item.SelfReferenceId2); if (item.SelfReferenceIdNavigation != null) { var selfReferenceIdModel = new ApiSelfReferenceServerResponseModel(); selfReferenceIdModel.SetProperties( item.SelfReferenceIdNavigation.Id, item.SelfReferenceIdNavigation.SelfReferenceId, item.SelfReferenceIdNavigation.SelfReferenceId2); model.SetSelfReferenceIdNavigation(selfReferenceIdModel); } if (item.SelfReferenceId2Navigation != null) { var selfReferenceId2Model = new ApiSelfReferenceServerResponseModel(); selfReferenceId2Model.SetProperties( item.SelfReferenceId2Navigation.Id, item.SelfReferenceId2Navigation.SelfReferenceId, item.SelfReferenceId2Navigation.SelfReferenceId2); model.SetSelfReferenceId2Navigation(selfReferenceId2Model); } return(model); }
public virtual ApiSelfReferenceClientRequestModel MapServerResponseToClientRequest( ApiSelfReferenceServerResponseModel response) { var request = new ApiSelfReferenceClientRequestModel(); request.SetProperties( response.SelfReferenceId, response.SelfReferenceId2); return(request); }
public virtual ApiSelfReferenceServerResponseModel MapServerRequestToResponse( int id, ApiSelfReferenceServerRequestModel request) { var response = new ApiSelfReferenceServerResponseModel(); response.SetProperties(id, request.SelfReferenceId, request.SelfReferenceId2); return(response); }
public void MapEntityToModel() { var mapper = new DALSelfReferenceMapper(); SelfReference item = new SelfReference(); item.SetProperties(1, 1, 1); ApiSelfReferenceServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.SelfReferenceId.Should().Be(1); response.SelfReferenceId2.Should().Be(1); }
public virtual async Task <UpdateResponse <ApiSelfReferenceServerResponseModel> > Update( int id, ApiSelfReferenceServerRequestModel model) { var validationResult = await this.SelfReferenceModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { SelfReference record = this.DalSelfReferenceMapper.MapModelToEntity(id, model); await this.SelfReferenceRepository.Update(record); record = await this.SelfReferenceRepository.Get(id); ApiSelfReferenceServerResponseModel apiModel = this.DalSelfReferenceMapper.MapEntityToModel(record); await this.mediator.Publish(new SelfReferenceUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiSelfReferenceServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiSelfReferenceServerResponseModel> .UpdateResponse(validationResult)); } }
public SelfReferenceUpdatedNotification(ApiSelfReferenceServerResponseModel record) { this.Record = record; }
public void SetSelfReferenceId2Navigation(ApiSelfReferenceServerResponseModel value) { this.SelfReferenceId2Navigation = value; }