Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        public async Task DeleteAsync()
        {
            await _service.DeleteAsync(It.IsAny <int>());

            _debtRepoMock.Verify(m => m.DeleteAsync(It.IsAny <int>()), Times.Exactly(1));
        }