예제 #1
0
        public override void OnActionExecuted(HttpActionExecutedContext filterContext)
        {
            CurrencyApiRequest request = new CurrencyApiRequest()
            {
                RequestUri      = filterContext.Request.RequestUri.ToString(),
                RequestDate     = DateTime.Now,
                SuccessResponse = filterContext.Response.IsSuccessStatusCode
            };

            using (var ctx = new LogToDbContext())
            {
                ctx.InRequests.Add(request);
                ctx.SaveChanges();
            }
        }
예제 #2
0
        private static void LogRequest(HttpWebResponse response)
        {
            NBPApiRequest request = new NBPApiRequest()
            {
                RequestUri      = response.ResponseUri.ToString(),
                RequestDate     = DateTime.Now,
                SuccessResponse = response.StatusCode == HttpStatusCode.OK
            };

            using (var ctx = new LogToDbContext())
            {
                ctx.OutRequests.Add(request);
                ctx.SaveChanges();
            }
        }