Beispiel #1
0
        public async Task <ActionResult> WithdrawAcount(int account_id, decimal amount, [FromServices] IResultStatus result)
        {
            try
            {
                await _accountInterface.WithdrawAcount(account_id, amount);

                result.status = "ok";
                return(Ok(result));
            }
            catch (BadLogicException ex) {
                result.status  = "error";
                result.message = "Отрицательный баланс";
                return(Ok(result));
            }
            catch (NotFindException ex)
            {
                result.status  = "error";
                result.message = ex.Message;
                return(NotFound(result));
            }
            catch (BadParametersException ex)
            {
                result.status  = "error";
                result.message = ex.Message;
                return(BadRequest(result));
            }
            catch
            {
                result.status  = "error";
                result.message = "Внутренняя ошибка";
                return(StatusCode(500));
            }
        }