public virtual ApiEventStudentServerResponseModel MapEntityToModel(
            EventStudent item)
        {
            var model = new ApiEventStudentServerResponseModel();

            model.SetProperties(item.Id,
                                item.EventId,
                                item.StudentId);
            if (item.EventIdNavigation != null)
            {
                var eventIdModel = new ApiEventServerResponseModel();
                eventIdModel.SetProperties(
                    item.EventIdNavigation.Id,
                    item.EventIdNavigation.ActualEndDate,
                    item.EventIdNavigation.ActualStartDate,
                    item.EventIdNavigation.BillAmount,
                    item.EventIdNavigation.EventStatusId,
                    item.EventIdNavigation.ScheduledEndDate,
                    item.EventIdNavigation.ScheduledStartDate,
                    item.EventIdNavigation.StudentNotes,
                    item.EventIdNavigation.TeacherNotes);

                model.SetEventIdNavigation(eventIdModel);
            }

            if (item.StudentIdNavigation != null)
            {
                var studentIdModel = new ApiStudentServerResponseModel();
                studentIdModel.SetProperties(
                    item.StudentIdNavigation.Id,
                    item.StudentIdNavigation.Birthday,
                    item.StudentIdNavigation.Email,
                    item.StudentIdNavigation.EmailRemindersEnabled,
                    item.StudentIdNavigation.FamilyId,
                    item.StudentIdNavigation.FirstName,
                    item.StudentIdNavigation.IsAdult,
                    item.StudentIdNavigation.LastName,
                    item.StudentIdNavigation.Phone,
                    item.StudentIdNavigation.SmsRemindersEnabled,
                    item.StudentIdNavigation.UserId);

                model.SetStudentIdNavigation(studentIdModel);
            }

            return(model);
        }
Esempio n. 2
0
        public virtual ApiStudentServerResponseModel MapServerRequestToResponse(
            int id,
            ApiStudentServerRequestModel request)
        {
            var response = new ApiStudentServerResponseModel();

            response.SetProperties(id,
                                   request.Birthday,
                                   request.Email,
                                   request.EmailRemindersEnabled,
                                   request.FamilyId,
                                   request.FirstName,
                                   request.IsAdult,
                                   request.LastName,
                                   request.Phone,
                                   request.SmsRemindersEnabled,
                                   request.UserId);
            return(response);
        }
Esempio n. 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);
        }