public virtual ApiPipelineStepNoteClientRequestModel MapServerResponseToClientRequest( ApiPipelineStepNoteServerResponseModel response) { var request = new ApiPipelineStepNoteClientRequestModel(); request.SetProperties( response.EmployeeId, response.Note, response.PipelineStepId); return(request); }
public virtual ApiPipelineStepNoteServerResponseModel MapServerRequestToResponse( int id, ApiPipelineStepNoteServerRequestModel request) { var response = new ApiPipelineStepNoteServerResponseModel(); response.SetProperties(id, request.EmployeeId, request.Note, request.PipelineStepId); return(response); }
public void MapEntityToModel() { var mapper = new DALPipelineStepNoteMapper(); PipelineStepNote item = new PipelineStepNote(); item.SetProperties(1, 1, "A", 1); ApiPipelineStepNoteServerResponseModel response = mapper.MapEntityToModel(item); response.EmployeeId.Should().Be(1); response.Id.Should().Be(1); response.Note.Should().Be("A"); response.PipelineStepId.Should().Be(1); }
public virtual async Task <UpdateResponse <ApiPipelineStepNoteServerResponseModel> > Update( int id, ApiPipelineStepNoteServerRequestModel model) { var validationResult = await this.PipelineStepNoteModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { PipelineStepNote record = this.DalPipelineStepNoteMapper.MapModelToEntity(id, model); await this.PipelineStepNoteRepository.Update(record); record = await this.PipelineStepNoteRepository.Get(id); ApiPipelineStepNoteServerResponseModel apiModel = this.DalPipelineStepNoteMapper.MapEntityToModel(record); await this.mediator.Publish(new PipelineStepNoteUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiPipelineStepNoteServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiPipelineStepNoteServerResponseModel> .UpdateResponse(validationResult)); } }
public virtual ApiPipelineStepNoteServerResponseModel MapEntityToModel( PipelineStepNote item) { var model = new ApiPipelineStepNoteServerResponseModel(); model.SetProperties(item.Id, item.EmployeeId, item.Note, item.PipelineStepId); if (item.EmployeeIdNavigation != null) { var employeeIdModel = new ApiEmployeeServerResponseModel(); employeeIdModel.SetProperties( item.EmployeeIdNavigation.Id, item.EmployeeIdNavigation.FirstName, item.EmployeeIdNavigation.IsSalesPerson, item.EmployeeIdNavigation.IsShipper, item.EmployeeIdNavigation.LastName); model.SetEmployeeIdNavigation(employeeIdModel); } if (item.PipelineStepIdNavigation != null) { var pipelineStepIdModel = new ApiPipelineStepServerResponseModel(); pipelineStepIdModel.SetProperties( item.PipelineStepIdNavigation.Id, item.PipelineStepIdNavigation.Name, item.PipelineStepIdNavigation.PipelineStepStatusId, item.PipelineStepIdNavigation.ShipperId); model.SetPipelineStepIdNavigation(pipelineStepIdModel); } return(model); }
public PipelineStepNoteUpdatedNotification(ApiPipelineStepNoteServerResponseModel record) { this.Record = record; }