public static Model.ToDoTaskInfoSearchQuery Convert(Client.ToDoTaskInfoSearchQuery clientQuery) { if (clientQuery == null) { throw new ArgumentNullException(nameof(clientQuery)); } var modelSort = clientQuery.Sort.HasValue ? SortTypeConverter.Convert(clientQuery.Sort.Value) : (Models.SortType?)null; var modelSortBy = clientQuery.SortBy.HasValue ? ToDoTaskSortByConverter.Convert(clientQuery.SortBy.Value) : (Model.ToDoTaskSortBy?)null; var priority = clientQuery.Priority.HasValue ? ToDoTaskPriorityConverter.Convert(clientQuery.Priority.Value) : (Model.ToDoTaskPriority?)null; return(new Model.ToDoTaskInfoSearchQuery { CreatedFrom = clientQuery.CreatedFrom, CreatedTo = clientQuery.CreatedTo, Limit = clientQuery.Limit, Offset = clientQuery.Offset, Priority = priority, EndAt = clientQuery.EndAt, Sort = modelSort, SortBy = modelSortBy }); }
public static Model.ToDoTaskPatchInfo Convert(Guid taskId, Client.ToDoTaskPatchInfo clientPatch) { if (clientPatch == null) { throw new ArgumentNullException(nameof(clientPatch)); } return(new Model.ToDoTaskPatchInfo( taskId, clientPatch.Title, clientPatch.Text, clientPatch.EndAt, ToDoTaskPriorityConverter.Convert(clientPatch.Priority))); }
public static Client.ToDoTaskInfo Convert(Model.ToDoTaskInfo modelTaskInfo) { if (modelTaskInfo == null) { throw new ArgumentNullException(nameof(modelTaskInfo)); } return(new Client.ToDoTaskInfo { Id = modelTaskInfo.Id.ToString(), UserId = modelTaskInfo.UserId.ToString(), Title = modelTaskInfo.Title, CreatedAt = modelTaskInfo.CreatedAt, LastUpdatedAt = modelTaskInfo.LastUpdatedAt, Priority = ToDoTaskPriorityConverter.Convert(modelTaskInfo.Priority), EndAt = modelTaskInfo.EndAt }); }
public static Client.ToDoTask Convert(Model.ToDoTask modelTask) { if (modelTask == null) { throw new ArgumentNullException(nameof(modelTask)); } return(new Client.ToDoTask { Id = modelTask.Id.ToString(), UserId = modelTask.UserId.ToString(), Title = modelTask.Title, Text = modelTask.Text, CreatedAt = modelTask.CreatedAt, LastUpdatedAt = modelTask.LastUpdatedAt, Priority = ToDoTaskPriorityConverter.Convert(modelTask.Priority), EndAt = modelTask.EndAt, }); }
public static Model.TodoTaskCreationInfo Convert(string clientUserId, Client.ToDoTaskBuildInfo clientBuildInfo) { if (clientUserId == null) { throw new ArgumentNullException(nameof(clientUserId)); } if (clientBuildInfo == null) { throw new ArgumentNullException(nameof(clientBuildInfo)); } if (!Guid.TryParse(clientUserId, out var modelUserId)) { throw new ArgumentException($"The client user id \"{clientUserId}\" is invalid.", nameof(clientUserId)); } return(new Model.TodoTaskCreationInfo(modelUserId, clientBuildInfo.Title, clientBuildInfo.Text, clientBuildInfo.EndAt, ToDoTaskPriorityConverter.Convert(clientBuildInfo.Priority))); }