Exemplo n.º 1
0
        protected ApiResponseBase TryAction(Action action)
        {
            var result = new ApiResponseBase();

            try
            {
                action();
            }
            catch (Exception ex)
            {
                CatchException(ex, result);
            }
            return(result);
        }
Exemplo n.º 2
0
        protected ApiResponseBase TryFunc <T>(Func <T> func)
        {
            var result = new ApiResponseBase <T>();

            try
            {
                result.Data = func();
            }
            catch (Exception ex)
            {
                CatchException(ex, result);
            }
            return(result);
        }