public virtual BOPipelineStepNote MapEFToBO( PipelineStepNote ef) { var bo = new BOPipelineStepNote(); bo.SetProperties( ef.Id, ef.EmployeeId, ef.Note, ef.PipelineStepId); return(bo); }
public void MapModelToEntity() { var mapper = new DALPipelineStepNoteMapper(); ApiPipelineStepNoteServerRequestModel model = new ApiPipelineStepNoteServerRequestModel(); model.SetProperties(1, "A", 1); PipelineStepNote response = mapper.MapModelToEntity(1, model); response.EmployeeId.Should().Be(1); response.Note.Should().Be("A"); response.PipelineStepId.Should().Be(1); }
public virtual PipelineStepNote MapBOToEF( BOPipelineStepNote bo) { PipelineStepNote efPipelineStepNote = new PipelineStepNote(); efPipelineStepNote.SetProperties( bo.EmployeeId, bo.Id, bo.Note, bo.PipelineStepId); return(efPipelineStepNote); }
public virtual async Task <ApiPipelineStepNoteServerResponseModel> Get(int id) { PipelineStepNote record = await this.PipelineStepNoteRepository.Get(id); if (record == null) { return(null); } else { return(this.DalPipelineStepNoteMapper.MapEntityToModel(record)); } }
public void MapEntityToModelList() { var mapper = new DALPipelineStepNoteMapper(); PipelineStepNote item = new PipelineStepNote(); item.SetProperties(1, 1, "A", 1); List <ApiPipelineStepNoteServerResponseModel> response = mapper.MapEntityToModel(new List <PipelineStepNote>() { { item } }); response.Count.Should().Be(1); }
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 void MapEFToBOList() { var mapper = new DALPipelineStepNoteMapper(); PipelineStepNote entity = new PipelineStepNote(); entity.SetProperties(1, 1, "A", 1); List <BOPipelineStepNote> response = mapper.MapEFToBO(new List <PipelineStepNote>() { entity }); response.Count.Should().Be(1); }
public void MapEFToBO() { var mapper = new DALPipelineStepNoteMapper(); PipelineStepNote entity = new PipelineStepNote(); entity.SetProperties(1, 1, "A", 1); BOPipelineStepNote response = mapper.MapEFToBO(entity); response.EmployeeId.Should().Be(1); response.Id.Should().Be(1); response.Note.Should().Be("A"); response.PipelineStepId.Should().Be(1); }
public void MapBOToEF() { var mapper = new DALPipelineStepNoteMapper(); var bo = new BOPipelineStepNote(); bo.SetProperties(1, 1, "A", 1); PipelineStepNote response = mapper.MapBOToEF(bo); response.EmployeeId.Should().Be(1); response.Id.Should().Be(1); response.Note.Should().Be("A"); response.PipelineStepId.Should().Be(1); }
public virtual PipelineStepNote MapModelToEntity( int id, ApiPipelineStepNoteServerRequestModel model ) { PipelineStepNote item = new PipelineStepNote(); item.SetProperties( id, model.EmployeeId, model.Note, model.PipelineStepId); return(item); }
public async void Get() { var mock = new ServiceMockFacade<IPipelineStepNoteRepository>(); var record = new PipelineStepNote(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny<int>())).Returns(Task.FromResult(record)); var service = new PipelineStepNoteService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.PipelineStepNoteModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLPipelineStepNoteMapperMock, mock.DALMapperMockFactory.DALPipelineStepNoteMapperMock); ApiPipelineStepNoteResponseModel response = await service.Get(default(int)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny<int>())); }
public virtual async Task <CreateResponse <ApiPipelineStepNoteServerResponseModel> > Create( ApiPipelineStepNoteServerRequestModel model) { CreateResponse <ApiPipelineStepNoteServerResponseModel> response = ValidationResponseFactory <ApiPipelineStepNoteServerResponseModel> .CreateResponse(await this.PipelineStepNoteModelValidator.ValidateCreateAsync(model)); if (response.Success) { PipelineStepNote record = this.DalPipelineStepNoteMapper.MapModelToEntity(default(int), model); record = await this.PipelineStepNoteRepository.Create(record); response.SetRecord(this.DalPipelineStepNoteMapper.MapEntityToModel(record)); await this.mediator.Publish(new PipelineStepNoteCreatedNotification(response.Record)); } return(response); }
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); }