示例#1
0
        public virtual ApiAdminServerResponseModel MapEntityToModel(
            Admin item)
        {
            var model = new ApiAdminServerResponseModel();

            model.SetProperties(item.Id,
                                item.Birthday,
                                item.Email,
                                item.FirstName,
                                item.LastName,
                                item.Phone,
                                item.UserId);
            if (item.UserIdNavigation != null)
            {
                var userIdModel = new ApiUserServerResponseModel();
                userIdModel.SetProperties(
                    item.UserIdNavigation.Id,
                    item.UserIdNavigation.Password,
                    item.UserIdNavigation.Username);

                model.SetUserIdNavigation(userIdModel);
            }

            return(model);
        }
示例#2
0
        public virtual ApiUserServerResponseModel MapEntityToModel(
            User item)
        {
            var model = new ApiUserServerResponseModel();

            model.SetProperties(item.Id,
                                item.Password,
                                item.Username);

            return(model);
        }
示例#3
0
        public virtual ApiUserServerResponseModel MapServerRequestToResponse(
            int id,
            ApiUserServerRequestModel request)
        {
            var response = new ApiUserServerResponseModel();

            response.SetProperties(id,
                                   request.Password,
                                   request.Username);
            return(response);
        }
示例#4
0
        public virtual ApiStudentServerResponseModel MapEntityToModel(
            Student item)
        {
            var model = new ApiStudentServerResponseModel();

            model.SetProperties(item.Id,
                                item.Birthday,
                                item.Email,
                                item.EmailRemindersEnabled,
                                item.FamilyId,
                                item.FirstName,
                                item.IsAdult,
                                item.LastName,
                                item.Phone,
                                item.SmsRemindersEnabled,
                                item.UserId);
            if (item.FamilyIdNavigation != null)
            {
                var familyIdModel = new ApiFamilyServerResponseModel();
                familyIdModel.SetProperties(
                    item.FamilyIdNavigation.Id,
                    item.FamilyIdNavigation.Notes,
                    item.FamilyIdNavigation.PrimaryContactEmail,
                    item.FamilyIdNavigation.PrimaryContactFirstName,
                    item.FamilyIdNavigation.PrimaryContactLastName,
                    item.FamilyIdNavigation.PrimaryContactPhone);

                model.SetFamilyIdNavigation(familyIdModel);
            }

            if (item.UserIdNavigation != null)
            {
                var userIdModel = new ApiUserServerResponseModel();
                userIdModel.SetProperties(
                    item.UserIdNavigation.Id,
                    item.UserIdNavigation.Password,
                    item.UserIdNavigation.Username);

                model.SetUserIdNavigation(userIdModel);
            }

            return(model);
        }