Exemple #1
0
        public virtual ApiTeacherTeacherSkillServerResponseModel MapEntityToModel(
            TeacherTeacherSkill item)
        {
            var model = new ApiTeacherTeacherSkillServerResponseModel();

            model.SetProperties(item.Id,
                                item.TeacherId,
                                item.TeacherSkillId);
            if (item.TeacherIdNavigation != null)
            {
                var teacherIdModel = new ApiTeacherServerResponseModel();
                teacherIdModel.SetProperties(
                    item.TeacherIdNavigation.Id,
                    item.TeacherIdNavigation.Birthday,
                    item.TeacherIdNavigation.Email,
                    item.TeacherIdNavigation.FirstName,
                    item.TeacherIdNavigation.LastName,
                    item.TeacherIdNavigation.Phone,
                    item.TeacherIdNavigation.UserId);

                model.SetTeacherIdNavigation(teacherIdModel);
            }

            if (item.TeacherSkillIdNavigation != null)
            {
                var teacherSkillIdModel = new ApiTeacherSkillServerResponseModel();
                teacherSkillIdModel.SetProperties(
                    item.TeacherSkillIdNavigation.Id,
                    item.TeacherSkillIdNavigation.Name);

                model.SetTeacherSkillIdNavigation(teacherSkillIdModel);
            }

            return(model);
        }
Exemple #2
0
        public virtual ApiTeacherSkillClientRequestModel MapServerResponseToClientRequest(
            ApiTeacherSkillServerResponseModel response)
        {
            var request = new ApiTeacherSkillClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
Exemple #3
0
        public virtual ApiTeacherSkillServerResponseModel MapServerRequestToResponse(
            int id,
            ApiTeacherSkillServerRequestModel request)
        {
            var response = new ApiTeacherSkillServerResponseModel();

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
Exemple #4
0
        public virtual ApiTeacherSkillServerResponseModel MapEntityToModel(
            TeacherSkill item)
        {
            var model = new ApiTeacherSkillServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name);

            return(model);
        }
        public void MapEntityToModel()
        {
            var          mapper = new DALTeacherSkillMapper();
            TeacherSkill item   = new TeacherSkill();

            item.SetProperties(1, "A");
            ApiTeacherSkillServerResponseModel response = mapper.MapEntityToModel(item);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Exemple #6
0
        public virtual async Task <UpdateResponse <ApiTeacherSkillServerResponseModel> > Update(
            int id,
            ApiTeacherSkillServerRequestModel model)
        {
            var validationResult = await this.TeacherSkillModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                TeacherSkill record = this.DalTeacherSkillMapper.MapModelToEntity(id, model);
                await this.TeacherSkillRepository.Update(record);

                record = await this.TeacherSkillRepository.Get(id);

                ApiTeacherSkillServerResponseModel apiModel = this.DalTeacherSkillMapper.MapEntityToModel(record);
                await this.mediator.Publish(new TeacherSkillUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiTeacherSkillServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiTeacherSkillServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Exemple #7
0
 public TeacherSkillUpdatedNotification(ApiTeacherSkillServerResponseModel record)
 {
     this.Record = record;
 }
 public void SetTeacherSkillIdNavigation(ApiTeacherSkillServerResponseModel value)
 {
     this.TeacherSkillIdNavigation = value;
 }