public virtual ApiTeacherTeacherSkillServerRequestModel MapServerResponseToRequest( ApiTeacherTeacherSkillServerResponseModel response) { var request = new ApiTeacherTeacherSkillServerRequestModel(); request.SetProperties( response.TeacherId, response.TeacherSkillId); return(request); }
public virtual ApiTeacherTeacherSkillServerResponseModel MapServerRequestToResponse( int id, ApiTeacherTeacherSkillServerRequestModel request) { var response = new ApiTeacherTeacherSkillServerResponseModel(); response.SetProperties(id, request.TeacherId, request.TeacherSkillId); return(response); }
public void MapModelToEntity() { var mapper = new DALTeacherTeacherSkillMapper(); ApiTeacherTeacherSkillServerRequestModel model = new ApiTeacherTeacherSkillServerRequestModel(); model.SetProperties(1, 1); TeacherTeacherSkill response = mapper.MapModelToEntity(1, model); response.TeacherId.Should().Be(1); response.TeacherSkillId.Should().Be(1); }
public virtual TeacherTeacherSkill MapModelToEntity( int id, ApiTeacherTeacherSkillServerRequestModel model ) { TeacherTeacherSkill item = new TeacherTeacherSkill(); item.SetProperties( id, model.TeacherId, model.TeacherSkillId); return(item); }
public virtual async Task <CreateResponse <ApiTeacherTeacherSkillServerResponseModel> > Create( ApiTeacherTeacherSkillServerRequestModel model) { CreateResponse <ApiTeacherTeacherSkillServerResponseModel> response = ValidationResponseFactory <ApiTeacherTeacherSkillServerResponseModel> .CreateResponse(await this.TeacherTeacherSkillModelValidator.ValidateCreateAsync(model)); if (response.Success) { TeacherTeacherSkill record = this.DalTeacherTeacherSkillMapper.MapModelToEntity(default(int), model); record = await this.TeacherTeacherSkillRepository.Create(record); response.SetRecord(this.DalTeacherTeacherSkillMapper.MapEntityToModel(record)); await this.mediator.Publish(new TeacherTeacherSkillCreatedNotification(response.Record)); } return(response); }
public virtual async Task <UpdateResponse <ApiTeacherTeacherSkillServerResponseModel> > Update( int id, ApiTeacherTeacherSkillServerRequestModel model) { var validationResult = await this.TeacherTeacherSkillModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { TeacherTeacherSkill record = this.DalTeacherTeacherSkillMapper.MapModelToEntity(id, model); await this.TeacherTeacherSkillRepository.Update(record); record = await this.TeacherTeacherSkillRepository.Get(id); ApiTeacherTeacherSkillServerResponseModel apiModel = this.DalTeacherTeacherSkillMapper.MapEntityToModel(record); await this.mediator.Publish(new TeacherTeacherSkillUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiTeacherTeacherSkillServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiTeacherTeacherSkillServerResponseModel> .UpdateResponse(validationResult)); } }
public JsonPatchDocument <ApiTeacherTeacherSkillServerRequestModel> CreatePatch(ApiTeacherTeacherSkillServerRequestModel model) { var patch = new JsonPatchDocument <ApiTeacherTeacherSkillServerRequestModel>(); patch.Replace(x => x.TeacherId, model.TeacherId); patch.Replace(x => x.TeacherSkillId, model.TeacherSkillId); return(patch); }