コード例 #1
0
        public virtual ApiFamilyServerResponseModel MapServerRequestToResponse(
            int id,
            ApiFamilyServerRequestModel request)
        {
            var response = new ApiFamilyServerResponseModel();

            response.SetProperties(id,
                                   request.Notes,
                                   request.PrimaryContactEmail,
                                   request.PrimaryContactFirstName,
                                   request.PrimaryContactLastName,
                                   request.PrimaryContactPhone);
            return(response);
        }
コード例 #2
0
        public virtual ApiFamilyServerResponseModel MapEntityToModel(
            Family item)
        {
            var model = new ApiFamilyServerResponseModel();

            model.SetProperties(item.Id,
                                item.Notes,
                                item.PrimaryContactEmail,
                                item.PrimaryContactFirstName,
                                item.PrimaryContactLastName,
                                item.PrimaryContactPhone);

            return(model);
        }
コード例 #3
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);
        }