public virtual ApiTweetClientRequestModel MapServerResponseToClientRequest( ApiTweetServerResponseModel response) { var request = new ApiTweetClientRequestModel(); request.SetProperties( response.Content, response.Date, response.LocationId, response.Time, response.UserUserId); return(request); }
public virtual ApiTweetServerResponseModel MapServerRequestToResponse( int tweetId, ApiTweetServerRequestModel request) { var response = new ApiTweetServerResponseModel(); response.SetProperties(tweetId, request.Content, request.Date, request.LocationId, request.Time, request.UserUserId); return(response); }
public virtual ApiQuoteTweetServerResponseModel MapEntityToModel( QuoteTweet item) { var model = new ApiQuoteTweetServerResponseModel(); model.SetProperties(item.QuoteTweetId, item.Content, item.Date, item.RetweeterUserId, item.SourceTweetId, item.Time); if (item.RetweeterUserIdNavigation != null) { var retweeterUserIdModel = new ApiUserServerResponseModel(); retweeterUserIdModel.SetProperties( item.RetweeterUserIdNavigation.UserId, item.RetweeterUserIdNavigation.BioImgUrl, item.RetweeterUserIdNavigation.Birthday, item.RetweeterUserIdNavigation.ContentDescription, item.RetweeterUserIdNavigation.Email, item.RetweeterUserIdNavigation.FullName, item.RetweeterUserIdNavigation.HeaderImgUrl, item.RetweeterUserIdNavigation.Interest, item.RetweeterUserIdNavigation.LocationLocationId, item.RetweeterUserIdNavigation.Password, item.RetweeterUserIdNavigation.PhoneNumber, item.RetweeterUserIdNavigation.Privacy, item.RetweeterUserIdNavigation.Username, item.RetweeterUserIdNavigation.Website); model.SetRetweeterUserIdNavigation(retweeterUserIdModel); } if (item.SourceTweetIdNavigation != null) { var sourceTweetIdModel = new ApiTweetServerResponseModel(); sourceTweetIdModel.SetProperties( item.SourceTweetIdNavigation.TweetId, item.SourceTweetIdNavigation.Content, item.SourceTweetIdNavigation.Date, item.SourceTweetIdNavigation.LocationId, item.SourceTweetIdNavigation.Time, item.SourceTweetIdNavigation.UserUserId); model.SetSourceTweetIdNavigation(sourceTweetIdModel); } return(model); }
public void MapEntityToModel() { var mapper = new DALTweetMapper(); Tweet item = new Tweet(); item.SetProperties(1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, TimeSpan.Parse("01:00:00"), 1); ApiTweetServerResponseModel response = mapper.MapEntityToModel(item); response.Content.Should().Be("A"); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.LocationId.Should().Be(1); response.Time.Should().Be(TimeSpan.Parse("01:00:00")); response.TweetId.Should().Be(1); response.UserUserId.Should().Be(1); }
public virtual ApiTweetServerResponseModel MapEntityToModel( Tweet item) { var model = new ApiTweetServerResponseModel(); model.SetProperties(item.TweetId, item.Content, item.Date, item.LocationId, item.Time, item.UserUserId); if (item.LocationIdNavigation != null) { var locationIdModel = new ApiLocationServerResponseModel(); locationIdModel.SetProperties( item.LocationIdNavigation.LocationId, item.LocationIdNavigation.GpsLat, item.LocationIdNavigation.GpsLong, item.LocationIdNavigation.LocationName); model.SetLocationIdNavigation(locationIdModel); } if (item.UserUserIdNavigation != null) { var userUserIdModel = new ApiUserServerResponseModel(); userUserIdModel.SetProperties( item.UserUserIdNavigation.UserId, item.UserUserIdNavigation.BioImgUrl, item.UserUserIdNavigation.Birthday, item.UserUserIdNavigation.ContentDescription, item.UserUserIdNavigation.Email, item.UserUserIdNavigation.FullName, item.UserUserIdNavigation.HeaderImgUrl, item.UserUserIdNavigation.Interest, item.UserUserIdNavigation.LocationLocationId, item.UserUserIdNavigation.Password, item.UserUserIdNavigation.PhoneNumber, item.UserUserIdNavigation.Privacy, item.UserUserIdNavigation.Username, item.UserUserIdNavigation.Website); model.SetUserUserIdNavigation(userUserIdModel); } return(model); }
public virtual async Task <UpdateResponse <ApiTweetServerResponseModel> > Update( int tweetId, ApiTweetServerRequestModel model) { var validationResult = await this.TweetModelValidator.ValidateUpdateAsync(tweetId, model); if (validationResult.IsValid) { Tweet record = this.DalTweetMapper.MapModelToEntity(tweetId, model); await this.TweetRepository.Update(record); record = await this.TweetRepository.Get(tweetId); ApiTweetServerResponseModel apiModel = this.DalTweetMapper.MapEntityToModel(record); await this.mediator.Publish(new TweetUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiTweetServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiTweetServerResponseModel> .UpdateResponse(validationResult)); } }
public void SetSourceTweetIdNavigation(ApiTweetServerResponseModel value) { this.SourceTweetIdNavigation = value; }
public TweetUpdatedNotification(ApiTweetServerResponseModel record) { this.Record = record; }