public virtual ApiCallPersonServerResponseModel MapEntityToModel( CallPerson item) { var model = new ApiCallPersonServerResponseModel(); model.SetProperties(item.Id, item.Note, item.PersonId, item.PersonTypeId); if (item.PersonIdNavigation != null) { var personIdModel = new ApiPersonServerResponseModel(); personIdModel.SetProperties( item.PersonIdNavigation.Id, item.PersonIdNavigation.FirstName, item.PersonIdNavigation.LastName, item.PersonIdNavigation.Phone, item.PersonIdNavigation.Ssn); model.SetPersonIdNavigation(personIdModel); } if (item.PersonTypeIdNavigation != null) { var personTypeIdModel = new ApiPersonTypeServerResponseModel(); personTypeIdModel.SetProperties( item.PersonTypeIdNavigation.Id, item.PersonTypeIdNavigation.Name); model.SetPersonTypeIdNavigation(personTypeIdModel); } return(model); }
public virtual ApiPersonTypeClientRequestModel MapServerResponseToClientRequest( ApiPersonTypeServerResponseModel response) { var request = new ApiPersonTypeClientRequestModel(); request.SetProperties( response.Name); return(request); }
public virtual ApiPersonTypeServerResponseModel MapEntityToModel( PersonType item) { var model = new ApiPersonTypeServerResponseModel(); model.SetProperties(item.Id, item.Name); return(model); }
public virtual ApiPersonTypeServerResponseModel MapServerRequestToResponse( int id, ApiPersonTypeServerRequestModel request) { var response = new ApiPersonTypeServerResponseModel(); response.SetProperties(id, request.Name); return(response); }
public void MapEntityToModel() { var mapper = new DALPersonTypeMapper(); PersonType item = new PersonType(); item.SetProperties(1, "A"); ApiPersonTypeServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual async Task <UpdateResponse <ApiPersonTypeServerResponseModel> > Update( int id, ApiPersonTypeServerRequestModel model) { var validationResult = await this.PersonTypeModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { PersonType record = this.DalPersonTypeMapper.MapModelToEntity(id, model); await this.PersonTypeRepository.Update(record); record = await this.PersonTypeRepository.Get(id); ApiPersonTypeServerResponseModel apiModel = this.DalPersonTypeMapper.MapEntityToModel(record); await this.mediator.Publish(new PersonTypeUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiPersonTypeServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiPersonTypeServerResponseModel> .UpdateResponse(validationResult)); } }
public PersonTypeUpdatedNotification(ApiPersonTypeServerResponseModel record) { this.Record = record; }
public void SetPersonTypeIdNavigation(ApiPersonTypeServerResponseModel value) { this.PersonTypeIdNavigation = value; }