Exemple #1
0
        LogEventInterop ToInterop(LogEvent le)
        {
            LogEventInterop lei = new LogEventInterop();

            lei.Message        = le.Message;
            lei.InnerException = le.InnerException;
            return(lei);
        }
Exemple #2
0
        LogEvent FromInterop(LogEventInterop lei)
        {
            LogEvent le = new LogEvent();

            le.Message        = lei.Message;
            le.InnerException = lei.InnerException;
            return(le);
        }
Exemple #3
0
        // GET: Error
        public async Task <ActionResult> Index()
        {
            Exception       e   = Server.GetLastError();
            LogEventInterop lei = new LogEventInterop();

            lei.Title          = "Web error";
            lei.Message        = e.Message;
            lei.InnerException = e.InnerException.Message;
            lei.StackTrace     = e.StackTrace;
            await WebApi(WebApiMethod.Post, "api/LogEvent", lei);

            return(View("Error"));
        }
Exemple #4
0
        public async Task <IHttpActionResult> PostLogEvent(LogEventInterop lei)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            LogEvent le = FromInterop(lei);

            db.LogEvents.Add(le);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = le.Id }, lei));
        }