Esempio n. 1
0
        public async Task <IActionResult> SafeExecute <T>(Func <Task <GenericResponse <T> > > action)
        {
            try
            {
                var result = await action();

                return(new StatusWithDataResult(result.StatusCode, result));
            }
            catch (HttpResponseException e)
            {
                return(new StatusWithDataResult(e.Response.StatusCode, GenericResponse <object> .AsFailure()));
            }
        }