public ActionResult <IEnumerable <Todo> > DeleteTodo(int id) { if (!_services.DeleteTodo(id)) { return(NotFound()); } return(GetTodos()); }
public async Task <IActionResult> DeleteConfirmed(int id) { var todo = await _context.Todos .Include(x => x.Medias) .Include(x => x.Comments) .Include(x => x.Participants) .SingleOrDefaultAsync(x => x.Id == id); ApplicationUser currentUser = await _userManager.GetUserAsync(User); /** Only allow task owner and boss can edit task */ if (todo.PersonInChargeId != currentUser.Id) { if (!User.IsInRole(RoleNameEnum.Boss)) { return(Forbid()); } } await _todoServices.DeleteTodo(todo, currentUser); return(Redirect(HttpContext.Request.Headers["Referer"])); }
public async Task DeleteTodo(Guid todoId) { await _todoServices.DeleteTodo(todoId); }
public IActionResult DeleteTodo(long id) { service.DeleteTodo(id); return(RedirectToAction("Index")); }