예제 #1
0
        public async Task <IActionResult> Bearer()
        {
            var         watch      = System.Diagnostics.Stopwatch.StartNew();
            string      methodName = "TweetsSearch";
            ResponseDTO response   = new ResponseDTO();

            try
            {
                Log.Write(appSettings, LogEnum.DEBUG.ToString(), label, className, methodName, $"REQUEST: ");
                response.Result = await TwitterService.Bearer(appSettings);

                response.Success = true;
                watch.Stop();
                Log.Write(appSettings, LogEnum.INFO.ToString(), label, className, methodName, $"RESULT: {JsonConvert.SerializeObject(response)} Execution Time: {watch.ElapsedMilliseconds} ms");
                return(Ok(response));
            }
            catch (Exception e)
            {
                response.Success = false;
                response.Msg     = e.Message;
                watch.Stop();
                Log.Write(appSettings, LogEnum.ERROR.ToString(), label, className, methodName, $"ERROR: {e.Source + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace}");
                return(BadRequest(response));
            }
        }