Ejemplo n.º 1
0
 public SubscriberDTO CreateSubscriber(SubscriberDTO instance)
 {
     instance.CreateTime = DateTime.UtcNow;
     return Subscriber.AddOrUpdateSubscriber(instance.ToEntity()).ToDTO();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Invoked when <see cref="ToDTO"/> operation is about to return.
        /// </summary>
        /// <param name="dto"><see cref="SubscriberDTO"/> converted from <see cref="Subscriber"/>.</param>
partial         static void OnDTO(this Subscriber entity, SubscriberDTO dto);
Ejemplo n.º 3
0
 public SubscriberDTO UpdateSubscriber(string id, SubscriberDTO instance)
 {
     instance.SubscriberId = int.Parse(id);
     return Subscriber.AddOrUpdateSubscriber(instance.ToEntity()).ToDTO();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Converts this instance of <see cref="Subscriber"/> to an instance of <see cref="SubscriberDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="Subscriber"/> to convert.</param>
        public static SubscriberDTO ToDTO(this Subscriber entity)
        {
            if (entity == null) return null;

            var dto = new SubscriberDTO();

            dto.SubscriberId = entity.SubscriberId;
            dto.UserId = entity.UserId;
            dto.ProjectId = entity.ProjectId;
            dto.Description = entity.Description;
            dto.SubscriberType = entity.SubscriberType;
            dto.CreateTime = entity.CreateTime;

            entity.OnDTO(dto);

            return dto;
        }