Exemplo n.º 1
0
        //DTO
        public DiscountDetailDTO ToDto()
        {
            DiscountDetailDTO dto = new DiscountDetailDTO();

            dto.Id          = this.Id;
            dto.Description = this.Description ?? string.Empty;
            dto.Amount      = this.Amount;

            return(dto);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Allows you to convert the current discount detail object to the DTO equivalent for use with the REST API
        /// </summary>
        /// <returns>A new instance of DiscountDetailDTO</returns>
        public DiscountDetailDTO ToDto()
        {
            var dto = new DiscountDetailDTO();

            dto.Id           = Id;
            dto.Description  = Description ?? string.Empty;
            dto.Amount       = Amount;
            dto.DiscountType = (int)DiscountType;
            return(dto);
        }
Exemplo n.º 3
0
        public void FromDto(DiscountDetailDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            this.Id          = dto.Id;
            this.Description = dto.Description ?? string.Empty;
            this.Amount      = dto.Amount;
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Allows you to populate the current DiscountDetail object using a DiscountDetailDTO instance
        /// </summary>
        /// <param name="dto">An instance of the discount detail from the REST API</param>
        public void FromDto(DiscountDetailDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            Id           = dto.Id;
            Description  = dto.Description ?? string.Empty;
            Amount       = dto.Amount;
            DiscountType = (PromotionType)dto.DiscountType;
        }