public async Task <SimpleTask> DeleteAsync(int id, int userId) { if (!Exists(id, userId)) { throw new ValidationException("Unauthorized"); } ToDoTask originalTask = await _tasksRepository.DeleteAsync(id, userId); var result = _mapper.Map <SimpleTask>(originalTask); return(result); }
public async Task <IActionResult> Delete(int?id) { if (id == null) { return(RedirectToAction("Error")); } if (!ModelState.IsValid) { return(RedirectToAction("Index")); } var task = await _repo.FindByIdAsync(id.Value); await _repo.DeleteAsync(task); return(RedirectToAction("Index")); }
public async Task DeleteTaskAsync(long taskId) { await _tasksRepository.DeleteAsync(taskId); }
public async Task DeleteAsync(TaskRef id) { await _tasksRepository.DeleteAsync(id).ConfigureAwait(false); await _unitOfWork.SaveChangesAsync().ConfigureAwait(false); }