public virtual ApiPostTypeClientRequestModel MapServerResponseToClientRequest( ApiPostTypeServerResponseModel response) { var request = new ApiPostTypeClientRequestModel(); request.SetProperties( response.RwType); return(request); }
public virtual ApiPostTypeServerResponseModel MapEntityToModel( PostType item) { var model = new ApiPostTypeServerResponseModel(); model.SetProperties(item.Id, item.RwType); return(model); }
public virtual ApiPostTypeServerResponseModel MapServerRequestToResponse( int id, ApiPostTypeServerRequestModel request) { var response = new ApiPostTypeServerResponseModel(); response.SetProperties(id, request.RwType); return(response); }
public void MapEntityToModel() { var mapper = new DALPostTypeMapper(); PostType item = new PostType(); item.SetProperties(1, "A"); ApiPostTypeServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.RwType.Should().Be("A"); }
public virtual async Task <UpdateResponse <ApiPostTypeServerResponseModel> > Update( int id, ApiPostTypeServerRequestModel model) { var validationResult = await this.PostTypeModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { PostType record = this.DalPostTypeMapper.MapModelToEntity(id, model); await this.PostTypeRepository.Update(record); record = await this.PostTypeRepository.Get(id); ApiPostTypeServerResponseModel apiModel = this.DalPostTypeMapper.MapEntityToModel(record); await this.mediator.Publish(new PostTypeUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiPostTypeServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiPostTypeServerResponseModel> .UpdateResponse(validationResult)); } }
public PostTypeUpdatedNotification(ApiPostTypeServerResponseModel record) { this.Record = record; }
public void SetPostTypeIdNavigation(ApiPostTypeServerResponseModel value) { this.PostTypeIdNavigation = value; }
public virtual ApiPostServerResponseModel MapEntityToModel( Post item) { var model = new ApiPostServerResponseModel(); model.SetProperties(item.Id, item.AcceptedAnswerId, item.AnswerCount, item.Body, item.ClosedDate, item.CommentCount, item.CommunityOwnedDate, item.CreationDate, item.FavoriteCount, item.LastActivityDate, item.LastEditDate, item.LastEditorDisplayName, item.LastEditorUserId, item.OwnerUserId, item.ParentId, item.PostTypeId, item.Score, item.Tag, item.Title, item.ViewCount); if (item.LastEditorUserIdNavigation != null) { var lastEditorUserIdModel = new ApiUserServerResponseModel(); lastEditorUserIdModel.SetProperties( item.LastEditorUserIdNavigation.Id, item.LastEditorUserIdNavigation.AboutMe, item.LastEditorUserIdNavigation.AccountId, item.LastEditorUserIdNavigation.Age, item.LastEditorUserIdNavigation.CreationDate, item.LastEditorUserIdNavigation.DisplayName, item.LastEditorUserIdNavigation.DownVote, item.LastEditorUserIdNavigation.EmailHash, item.LastEditorUserIdNavigation.LastAccessDate, item.LastEditorUserIdNavigation.Location, item.LastEditorUserIdNavigation.Reputation, item.LastEditorUserIdNavigation.UpVote, item.LastEditorUserIdNavigation.View, item.LastEditorUserIdNavigation.WebsiteUrl); model.SetLastEditorUserIdNavigation(lastEditorUserIdModel); } if (item.OwnerUserIdNavigation != null) { var ownerUserIdModel = new ApiUserServerResponseModel(); ownerUserIdModel.SetProperties( item.OwnerUserIdNavigation.Id, item.OwnerUserIdNavigation.AboutMe, item.OwnerUserIdNavigation.AccountId, item.OwnerUserIdNavigation.Age, item.OwnerUserIdNavigation.CreationDate, item.OwnerUserIdNavigation.DisplayName, item.OwnerUserIdNavigation.DownVote, item.OwnerUserIdNavigation.EmailHash, item.OwnerUserIdNavigation.LastAccessDate, item.OwnerUserIdNavigation.Location, item.OwnerUserIdNavigation.Reputation, item.OwnerUserIdNavigation.UpVote, item.OwnerUserIdNavigation.View, item.OwnerUserIdNavigation.WebsiteUrl); model.SetOwnerUserIdNavigation(ownerUserIdModel); } if (item.ParentIdNavigation != null) { var parentIdModel = new ApiPostServerResponseModel(); parentIdModel.SetProperties( item.ParentIdNavigation.Id, item.ParentIdNavigation.AcceptedAnswerId, item.ParentIdNavigation.AnswerCount, item.ParentIdNavigation.Body, item.ParentIdNavigation.ClosedDate, item.ParentIdNavigation.CommentCount, item.ParentIdNavigation.CommunityOwnedDate, item.ParentIdNavigation.CreationDate, item.ParentIdNavigation.FavoriteCount, item.ParentIdNavigation.LastActivityDate, item.ParentIdNavigation.LastEditDate, item.ParentIdNavigation.LastEditorDisplayName, item.ParentIdNavigation.LastEditorUserId, item.ParentIdNavigation.OwnerUserId, item.ParentIdNavigation.ParentId, item.ParentIdNavigation.PostTypeId, item.ParentIdNavigation.Score, item.ParentIdNavigation.Tag, item.ParentIdNavigation.Title, item.ParentIdNavigation.ViewCount); model.SetParentIdNavigation(parentIdModel); } if (item.PostTypeIdNavigation != null) { var postTypeIdModel = new ApiPostTypeServerResponseModel(); postTypeIdModel.SetProperties( item.PostTypeIdNavigation.Id, item.PostTypeIdNavigation.RwType); model.SetPostTypeIdNavigation(postTypeIdModel); } return(model); }