public virtual ApiColumnSameAsFKTableServerResponseModel MapEntityToModel( ColumnSameAsFKTable item) { var model = new ApiColumnSameAsFKTableServerResponseModel(); model.SetProperties(item.Id, item.Person, item.PersonId); if (item.PersonNavigation != null) { var personModel = new ApiPersonServerResponseModel(); personModel.SetProperties( item.PersonNavigation.PersonId, item.PersonNavigation.PersonName); model.SetPersonNavigation(personModel); } if (item.PersonIdNavigation != null) { var personIdModel = new ApiPersonServerResponseModel(); personIdModel.SetProperties( item.PersonIdNavigation.PersonId, item.PersonIdNavigation.PersonName); model.SetPersonIdNavigation(personIdModel); } return(model); }
public virtual ApiPersonClientRequestModel MapServerResponseToClientRequest( ApiPersonServerResponseModel response) { var request = new ApiPersonClientRequestModel(); request.SetProperties( response.PersonName); return(request); }
public virtual ApiPersonServerResponseModel MapServerRequestToResponse( int personId, ApiPersonServerRequestModel request) { var response = new ApiPersonServerResponseModel(); response.SetProperties(personId, request.PersonName); return(response); }
public virtual ApiPersonServerResponseModel MapEntityToModel( Person item) { var model = new ApiPersonServerResponseModel(); model.SetProperties(item.PersonId, item.PersonName); return(model); }
public void MapEntityToModel() { var mapper = new DALPersonMapper(); Person item = new Person(); item.SetProperties(1, "A"); ApiPersonServerResponseModel response = mapper.MapEntityToModel(item); response.PersonId.Should().Be(1); response.PersonName.Should().Be("A"); }
public virtual async Task <UpdateResponse <ApiPersonServerResponseModel> > Update( int personId, ApiPersonServerRequestModel model) { var validationResult = await this.PersonModelValidator.ValidateUpdateAsync(personId, model); if (validationResult.IsValid) { Person record = this.DalPersonMapper.MapModelToEntity(personId, model); await this.PersonRepository.Update(record); record = await this.PersonRepository.Get(personId); ApiPersonServerResponseModel apiModel = this.DalPersonMapper.MapEntityToModel(record); await this.mediator.Publish(new PersonUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiPersonServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiPersonServerResponseModel> .UpdateResponse(validationResult)); } }
public PersonUpdatedNotification(ApiPersonServerResponseModel record) { this.Record = record; }
public void SetPersonIdNavigation(ApiPersonServerResponseModel value) { this.PersonIdNavigation = value; }