コード例 #1
0
        public async Task <IActionResult> Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ValidationApiException(ApiErrorCode.MissingInformation, $"Parameter {nameof(id)} must be provided.");
            }

            await _itemsService.DeleteItemAsync(id);

            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> Delete(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(NotFound());
            }

            var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            var plan = await _itemsService.DeleteItemAsync(id, userId);

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

            return(Ok(new OperationResponse <ToDoItem>
            {
                IsSuccess = true,
                Message = "Item deleted successfully!",
                Record = plan
            }));
        }
コード例 #3
0
        public async Task <IActionResult> Delete(string id)
        {
            var result = await _itemsService.DeleteItemAsync(id, UserId);

            return(Ok(result.Message));
        }
コード例 #4
0
 public async Task DeleteItem(int id)
 {
     await _itemsService.DeleteItemAsync(id);
 }
コード例 #5
0
        public async Task <IActionResult> DeleteConfirmed(string id)
        {
            await service.DeleteItemAsync(id);

            return(RedirectToAction(nameof(Index)));
        }