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)); }
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()); } }
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 })); } }
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()); }
public async Task <IActionResult> DeleteWalletAndOtpRequest(string walletId) { await _walletService.DeleteWallet(walletId); return(Ok(new Response(true, HttpStatusCode.OK))); }
//[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)); }
public async Task <IActionResult> DeleteWallet(string walletId) { await _walletService.DeleteWallet(walletId); return(Ok()); }