public virtual ApiFollowerServerResponseModel MapEntityToModel( Follower item) { var model = new ApiFollowerServerResponseModel(); model.SetProperties(item.Id, item.Blocked, item.DateFollowed, item.FollowedUserId, item.FollowingUserId, item.FollowRequestStatu, item.Muted); if (item.FollowedUserIdNavigation != null) { var followedUserIdModel = new ApiUserServerResponseModel(); followedUserIdModel.SetProperties( item.FollowedUserIdNavigation.UserId, item.FollowedUserIdNavigation.BioImgUrl, item.FollowedUserIdNavigation.Birthday, item.FollowedUserIdNavigation.ContentDescription, item.FollowedUserIdNavigation.Email, item.FollowedUserIdNavigation.FullName, item.FollowedUserIdNavigation.HeaderImgUrl, item.FollowedUserIdNavigation.Interest, item.FollowedUserIdNavigation.LocationLocationId, item.FollowedUserIdNavigation.Password, item.FollowedUserIdNavigation.PhoneNumber, item.FollowedUserIdNavigation.Privacy, item.FollowedUserIdNavigation.Username, item.FollowedUserIdNavigation.Website); model.SetFollowedUserIdNavigation(followedUserIdModel); } if (item.FollowingUserIdNavigation != null) { var followingUserIdModel = new ApiUserServerResponseModel(); followingUserIdModel.SetProperties( item.FollowingUserIdNavigation.UserId, item.FollowingUserIdNavigation.BioImgUrl, item.FollowingUserIdNavigation.Birthday, item.FollowingUserIdNavigation.ContentDescription, item.FollowingUserIdNavigation.Email, item.FollowingUserIdNavigation.FullName, item.FollowingUserIdNavigation.HeaderImgUrl, item.FollowingUserIdNavigation.Interest, item.FollowingUserIdNavigation.LocationLocationId, item.FollowingUserIdNavigation.Password, item.FollowingUserIdNavigation.PhoneNumber, item.FollowingUserIdNavigation.Privacy, item.FollowingUserIdNavigation.Username, item.FollowingUserIdNavigation.Website); model.SetFollowingUserIdNavigation(followingUserIdModel); } return(model); }
public virtual ApiFollowerClientRequestModel MapServerResponseToClientRequest( ApiFollowerServerResponseModel response) { var request = new ApiFollowerClientRequestModel(); request.SetProperties( response.Blocked, response.DateFollowed, response.FollowedUserId, response.FollowingUserId, response.FollowRequestStatu, response.Muted); return(request); }
public virtual ApiFollowerServerResponseModel MapServerRequestToResponse( int id, ApiFollowerServerRequestModel request) { var response = new ApiFollowerServerResponseModel(); response.SetProperties(id, request.Blocked, request.DateFollowed, request.FollowedUserId, request.FollowingUserId, request.FollowRequestStatu, request.Muted); return(response); }
public void MapEntityToModel() { var mapper = new DALFollowerMapper(); Follower item = new Follower(); item.SetProperties(1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, "A", "A"); ApiFollowerServerResponseModel response = mapper.MapEntityToModel(item); response.Blocked.Should().Be("A"); response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.FollowedUserId.Should().Be(1); response.FollowingUserId.Should().Be(1); response.FollowRequestStatu.Should().Be("A"); response.Id.Should().Be(1); response.Muted.Should().Be("A"); }
public virtual async Task <UpdateResponse <ApiFollowerServerResponseModel> > Update( int id, ApiFollowerServerRequestModel model) { var validationResult = await this.FollowerModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { Follower record = this.DalFollowerMapper.MapModelToEntity(id, model); await this.FollowerRepository.Update(record); record = await this.FollowerRepository.Get(id); ApiFollowerServerResponseModel apiModel = this.DalFollowerMapper.MapEntityToModel(record); await this.mediator.Publish(new FollowerUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiFollowerServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiFollowerServerResponseModel> .UpdateResponse(validationResult)); } }
public FollowerUpdatedNotification(ApiFollowerServerResponseModel record) { this.Record = record; }