public TemplateProperty CopyFrom(TemplatePropertyDto dto)
 {
     this.TemplateId   = dto.TemplateId;
     this.PropertyId   = dto.PropertyId;
     this.DefaultValue = dto.DefaultValue;
     this.IsRequired   = dto.IsRequired;
     this.Version      = dto.Version;
     if (dto?.TemplateDto != null)
     {
         this.Template.CopyFrom(dto?.TemplateDto);
     }
     if (dto?.PropertyDto != null)
     {
         this.Property.CopyFrom(dto?.PropertyDto);
     }
     BaseCopyFrom <TemplateProperty>(dto);
     return(this);
 }
Example #2
0
 public TemplatePropertyDto CopyTo(TemplatePropertyDto dto)
 {
     dto.TemplateId   = this.TemplateId;
     dto.PropertyId   = this.PropertyId;
     dto.DefaultValue = this.DefaultValue;
     dto.IsRequired   = this.IsRequired;
     dto.Version      = this.Version;
     if ((dto?.TemplateDto) != null)
     {
         this.Template.CopyTo(dto?.TemplateDto);
     }
     if ((dto?.PropertyDto) != null)
     {
         this.Property.CopyTo(dto?.PropertyDto);
     }
     BaseCopyTo <TemplatePropertyDto>(dto);
     return(dto);
 }
 public async Task <ServiceResponse <int> > PutTemplateProperty(int id, [FromBody] TemplatePropertyDto templatepropertyDto) => await Sm.DeviceService.RunAsync(x => x.UpdateTemplateProperty(templatepropertyDto));
 public async Task <ServiceResponse <long> > PostTemplateProperty([FromBody] TemplatePropertyDto templatepropertyDto) => await Sm.DeviceService.RunAsync(x => x.InsertTemplateProperty(templatepropertyDto));
Example #5
0
        public ServiceResponse <IEnumerable <TemplatePropertyDto> > ListTemplateProperty(TemplatePropertyDto templatePropertyDto, PagingDto pagingDto)
        {
            var Rm = new RepositoryManager(ServiceContext);
            IEnumerable <TemplateProperty>    list       = Rm.TemplatePropertyRepository.List(templatePropertyDto, ref pagingDto);
            IEnumerable <TemplatePropertyDto> restulList = list.Select(entity => entity.CopyTo(new TemplatePropertyDto())).ToList();

            if (list == null || !list.Any())
            {
                throw new ServiceException(ExceptionType.Warning, Translate(MessagesConstants.WRN_RECORD_NOT_FOUND));
            }
            return(new ServiceResponse <IEnumerable <TemplatePropertyDto> >(restulList, pagingDto.count));
        }