示例#1
0
        public async Task <TodoItemViewModel[]> GetIncompleteItemsAsync(AppUser user)
        {
            TodoServiceHttpClient     todoServiceClient = new TodoServiceHttpClient(url, httpClient);
            ICollection <ToDoItemDTO> dtoItems          = await todoServiceClient.GetAsync(user.Id);

            ICollection <TodoItemViewModel> returnValue = _mapper.Map <ICollection <TodoItemViewModel> >(dtoItems);

            return(returnValue.ToArray());
        }
示例#2
0
        public async Task <bool> MarkDoneAsync(TodoItemViewModel item, AppUser user)
        {
            TodoServiceHttpClient todoServiceClient = new TodoServiceHttpClient(url, httpClient);

            item.OwnerId = user.Id;
            item.IsDone  = true;

            await todoServiceClient.PutAsync(item.Id, _mapper.Map <ToDoItemDTO>(item));

            return(true);
        }
示例#3
0
        public async Task <Guid> AddItemAsync(TodoItemViewModel newItem, AppUser user)
        {
            TodoServiceHttpClient todoServiceClient = new TodoServiceHttpClient(url, httpClient);

            newItem.OwnerId = user.Id;
            newItem.IsDone  = false;
            newItem.DueAt   = DateTimeOffset.Now.AddDays(3);
            Guid returnValue = await todoServiceClient.PostAsync(_mapper.Map <ToDoItemDTO>(newItem));

            return(returnValue);
        }