コード例 #1
0
ファイル: DALBadgeMapper.cs プロジェクト: codenesium/samples
        public virtual ApiBadgeServerResponseModel MapEntityToModel(
            Badge item)
        {
            var model = new ApiBadgeServerResponseModel();

            model.SetProperties(item.Id,
                                item.Date,
                                item.Name,
                                item.UserId);
            if (item.UserIdNavigation != null)
            {
                var userIdModel = new ApiUserServerResponseModel();
                userIdModel.SetProperties(
                    item.UserIdNavigation.Id,
                    item.UserIdNavigation.AboutMe,
                    item.UserIdNavigation.AccountId,
                    item.UserIdNavigation.Age,
                    item.UserIdNavigation.CreationDate,
                    item.UserIdNavigation.DisplayName,
                    item.UserIdNavigation.DownVote,
                    item.UserIdNavigation.EmailHash,
                    item.UserIdNavigation.LastAccessDate,
                    item.UserIdNavigation.Location,
                    item.UserIdNavigation.Reputation,
                    item.UserIdNavigation.UpVote,
                    item.UserIdNavigation.View,
                    item.UserIdNavigation.WebsiteUrl);

                model.SetUserIdNavigation(userIdModel);
            }

            return(model);
        }
コード例 #2
0
        public virtual ApiBadgeServerResponseModel MapServerRequestToResponse(
            int id,
            ApiBadgeServerRequestModel request)
        {
            var response = new ApiBadgeServerResponseModel();

            response.SetProperties(id,
                                   request.Date,
                                   request.Name,
                                   request.UserId);
            return(response);
        }