public virtual ApiUnitDispositionClientRequestModel MapServerResponseToClientRequest( ApiUnitDispositionServerResponseModel response) { var request = new ApiUnitDispositionClientRequestModel(); request.SetProperties( response.Name); return(request); }
public virtual ApiUnitDispositionServerResponseModel MapEntityToModel( UnitDisposition item) { var model = new ApiUnitDispositionServerResponseModel(); model.SetProperties(item.Id, item.Name); return(model); }
public virtual ApiUnitDispositionServerResponseModel MapServerRequestToResponse( int id, ApiUnitDispositionServerRequestModel request) { var response = new ApiUnitDispositionServerResponseModel(); response.SetProperties(id, request.Name); return(response); }
public void MapEntityToModel() { var mapper = new DALUnitDispositionMapper(); UnitDisposition item = new UnitDisposition(); item.SetProperties(1, "A"); ApiUnitDispositionServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual async Task <UpdateResponse <ApiUnitDispositionServerResponseModel> > Update( int id, ApiUnitDispositionServerRequestModel model) { var validationResult = await this.UnitDispositionModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { UnitDisposition record = this.DalUnitDispositionMapper.MapModelToEntity(id, model); await this.UnitDispositionRepository.Update(record); record = await this.UnitDispositionRepository.Get(id); ApiUnitDispositionServerResponseModel apiModel = this.DalUnitDispositionMapper.MapEntityToModel(record); await this.mediator.Publish(new UnitDispositionUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiUnitDispositionServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiUnitDispositionServerResponseModel> .UpdateResponse(validationResult)); } }
public UnitDispositionUpdatedNotification(ApiUnitDispositionServerResponseModel record) { this.Record = record; }