Exemple #1
0
        public async Task <IActionResult> OnPostDeleteItemAsync(Guid id)
        {
            IdentityUser user;

            user = await this.GetCurrentUser();

            await _todoItemService.DeleteItemAsync(id, user);

            return(this.Redirect("./"));
        }
Exemple #2
0
        public async Task <ActionResult> Delete(int id)
        {
            var item = await toDoService.GetToDoItemByIdAsync(id);

            if (item == null)
            {
                return(NotFound());
            }

            await toDoService.DeleteItemAsync(item);

            return(Ok());
        }
Exemple #3
0
        public async Task <IActionResult> DeleteTodoItem(long id)
        {
            var todoItem = await _service.GetItemAsync(id);

            if (todoItem == null)
            {
                return(NotFound());
            }

            await _service.DeleteItemAsync(id);

            return(NoContent());
        }
        public async Task <IActionResult> DeleteItem(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(RedirectToAction("Index"));
            }

            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Challenge());
            }

            var successful = await _todoItemService.DeleteItemAsync(id, currentUser);

            if (!successful)
            {
                return(BadRequest("Could not mark item as done."));
            }

            return(RedirectToAction("Index"));
        }