public async Task <ActionResult> Delete(int id) { try { await _debtService.DeleteAsync(id); } catch (ServiceException e) { throw new WebUiException($"Ошибка в контроллере {nameof(DebtController)} в методе {nameof(Delete)}", e); } return(RedirectToAction("DebtList")); }
public async Task <IActionResult> Delete(int id) { int userId; try { userId = IdentityHelper.GetUserId(User); } catch (UnauthorizedAccessException) { return(Unauthorized()); } await _debtService.DeleteAsync(id, userId); return(NoContent()); }
public async Task DeleteAsync() { await _service.DeleteAsync(It.IsAny <int>()); _debtRepoMock.Verify(m => m.DeleteAsync(It.IsAny <int>()), Times.Exactly(1)); }