コード例 #1
0
        public async Task <ActionResult <Result> > DeletWallet(long walletId)
        {
            var result = await _walletService.DeleteWallet(new WalletDto { Id = walletId });

            if (!result.Succeeded)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
コード例 #2
0
        public IActionResult DeleteWallet(int id)
        {
            var userId      = HttpContext.User.Identity.Name;
            var walletModel = _walletService.GetWallet(id);

            if (walletModel.OwnerId == int.Parse(userId))
            {
                _walletService.DeleteWallet(id);
                return(NoContent());
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #3
0
 public IActionResult Delete()
 {
     try
     {
         var usr    = userManager.GetUserAsync(HttpContext.User).Result;
         var wallet = walletService.GetWallets().Where(s => s.UserID == usr.Id).FirstOrDefault();
         walletService.DeleteWallet(wallet.Id);
         return(Ok(new WalletResponse {
             Message = "Successfully deleted", IsSuccess = true
         }));
     }
     catch (Exception ex)
     {
         return(Ok(new WalletResponse {
             Message = "Failed to delete", IsSuccess = false
         }));
     }
 }
コード例 #4
0
        public async Task <IActionResult> DeleteKey(string key)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                return(BadRequest());
            }

            var apiKey = await _apiKeyService.GetApiKeyAsync(key);

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

            await _walletService.DeleteWallet(apiKey);

            return(Ok());
        }
コード例 #5
0
        public async Task <IActionResult> DeleteWalletAndOtpRequest(string walletId)
        {
            await _walletService.DeleteWallet(walletId);

            return(Ok(new Response(true, HttpStatusCode.OK)));
        }
コード例 #6
0
        //[Authorize(Roles = "Admin")]
        public async Task <IActionResult> DeleteWallet(int walletId)
        {
            var result = await walletService.DeleteWallet(new WalletIdDetails(walletId));

            return(StatusCode((int)result.Code, result.Value));
        }
コード例 #7
0
        public async Task <IActionResult> DeleteWallet(string walletId)
        {
            await _walletService.DeleteWallet(walletId);

            return(Ok());
        }