Example #1
0
 public void CopyFrom(TodoItemDTO other)
 {
     this.AllDay     = other.AllDay;
     this.Completed  = other.Completed;
     this.Name       = other.Name;
     this.Content    = other.Content;
     this.Start      = other.Start;
     this.Duration   = other.Duration;
     this.CategoryID = other.CategoryID;
     this.PriorityID = other.PriorityID;
     if (other.Alert != null)
     {
         this.Alert = new TodoItemAlertDTO()
         {
             AlertID   = other.Alert.AlertID,
             PlaySound = other.Alert.PlaySound
         };
     }
     else
     {
         this.Alert = null;
     }
     if (other.Recurrence != null)
     {
         this.Recurrence = new TodoItemRecurrenceDTO()
         {
             RecurrenceID          = other.Recurrence.RecurrenceID,
             RepeatAfterCompletion = other.Recurrence.RepeatAfterCompletion
         };
     }
     else
     {
         this.Recurrence = null;
     }
 }
Example #2
0
        // TodoItem
        public static Models.TodoItem ToModel(this DTO.TodoItemDTO dto, bool setCategory)
        {
            Models.Category      category = setCategory ? dto.Category?.ToModel(true, null) : null;
            Models.TodoItemAlert alert    = dto.Alert != null && dto.Alert.Alert != null ?
                                            new Models.TodoItemAlert(dto.Alert.Alert.ToModel(), dto.Alert.PlaySound) : null;
            Models.TodoItemRecurrence recurrence = dto.Recurrence != null && dto.Recurrence.Recurrence != null ?
                                                   new Models.TodoItemRecurrence(dto.Recurrence.Recurrence.ToModel(), dto.Recurrence.RepeatAfterCompletion) : null;
            Models.Priority priority = dto.Priority?.ToModel();

            return(new Models.TodoItem(dto.ID, dto.Name, dto.Content, dto.Completed, dto.Start, dto.Duration, dto.AllDay, category, alert, recurrence, priority));
        }