/// <summary> /// Deletes the Task /// </summary> /// <param name="id"></param> private async void ExecuteDeleteTaskCommandAsync(string id) { if (IocContainer.Instance.Container.Resolve <IPlatformService>().IsConnected()) { IsLoading = true; var result = await _taskService.DeleteTaskAsync(id); if (result == -1) { await _pageDialog.DisplayAlertAsync(AppConstants.AppName, AppConstants.AlertErrorInfo, AppConstants.AlertOkBtnTitle); return; } var task = TaskList.FirstOrDefault(x => x.Id == id); await _taskRepo.Delete(task); TaskList = _taskRepo.Get(); ExecuteFilterCommand(string.Empty); IsLoading = false; } else { await _pageDialog.DisplayAlertAsync(AppConstants.AlertOfflineTitle, AppConstants.AlertOfflineInfo, AppConstants.AlertOkBtnTitle); } }
public async Task <ActionResult> Delete(Guid id, CancellationToken cancellationToken) { var isDeleted = await service.DeleteTaskAsync(id, cancellationToken); if (!isDeleted) { return(NotFound()); } return(NoContent()); }
[HttpDelete("delete/{taskId}")] //bug with rights public async Task DeleteTask(long taskId) { await _tasksService.DeleteTaskAsync(taskId); }