public virtual ApiVideoClientRequestModel MapServerResponseToClientRequest( ApiVideoServerResponseModel response) { var request = new ApiVideoClientRequestModel(); request.SetProperties( response.Description, response.Title, response.Url); return(request); }
public virtual ApiVideoServerResponseModel MapServerRequestToResponse( int id, ApiVideoServerRequestModel request) { var response = new ApiVideoServerResponseModel(); response.SetProperties(id, request.Description, request.Title, request.Url); return(response); }
public virtual ApiVideoServerResponseModel MapEntityToModel( Video item) { var model = new ApiVideoServerResponseModel(); model.SetProperties(item.Id, item.Description, item.Title, item.Url); return(model); }
public void MapEntityToModel() { var mapper = new DALVideoMapper(); Video item = new Video(); item.SetProperties(1, "A", "A", "A"); ApiVideoServerResponseModel response = mapper.MapEntityToModel(item); response.Description.Should().Be("A"); response.Id.Should().Be(1); response.Title.Should().Be("A"); response.Url.Should().Be("A"); }
public virtual async Task <UpdateResponse <ApiVideoServerResponseModel> > Update( int id, ApiVideoServerRequestModel model) { var validationResult = await this.VideoModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { Video record = this.DalVideoMapper.MapModelToEntity(id, model); await this.VideoRepository.Update(record); record = await this.VideoRepository.Get(id); ApiVideoServerResponseModel apiModel = this.DalVideoMapper.MapEntityToModel(record); await this.mediator.Publish(new VideoUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiVideoServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiVideoServerResponseModel> .UpdateResponse(validationResult)); } }
public VideoUpdatedNotification(ApiVideoServerResponseModel record) { this.Record = record; }