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);
        }
Exemple #2
0
        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"));
        }
Exemple #3
0
 public async Task DeleteTaskAsync(long taskId)
 {
     await _tasksRepository.DeleteAsync(taskId);
 }
Exemple #4
0
        public async Task DeleteAsync(TaskRef id)
        {
            await _tasksRepository.DeleteAsync(id).ConfigureAwait(false);

            await _unitOfWork.SaveChangesAsync().ConfigureAwait(false);
        }