Example #1
0
 public ActionResult <IEnumerable <Todo> > DeleteTodo(int id)
 {
     if (!_services.DeleteTodo(id))
     {
         return(NotFound());
     }
     return(GetTodos());
 }
Example #2
0
        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"]));
        }
Example #3
0
 public async Task DeleteTodo(Guid todoId)
 {
     await _todoServices.DeleteTodo(todoId);
 }
 public IActionResult DeleteTodo(long id)
 {
     service.DeleteTodo(id);
     return(RedirectToAction("Index"));
 }