コード例 #1
0
ファイル: HomeController.cs プロジェクト: bcary/Vestn_Backend
        public ActionResult ErrorView()
        {
            List<Log> logs = new List<Log>();
            List<int> ids = new List<int>();
            List<DateTime> eventTimes = new List<DateTime>();
            List<string> locations = new List<string>();
            List<string> exceptions = new List<string>();

            //logs = logAccessor.GetLogs();

            List<ErrorModel> errorModelList = new List<ErrorModel>();

            int i = 0;
            foreach (Log log in logs)
            {
                ErrorModel er = new ErrorModel(log);
                errorModelList.Add(er);
            }

            return View(errorModelList);
        }
コード例 #2
0
        /// <summary>
        /// Handle the code that comes in and display the correct page.
        /// </summary>
        /// <param name="statusCode">The status code.</param>
        /// <param name="context">The <see cref="NancyContext"/> that the code rides on.</param>
        public void Handle(HttpStatusCode statusCode, NancyContext context)
        {
            try
            {
                var model = new ErrorModel
                {
                    ErrorCode = (int)statusCode,
                    Message = context.ResolvedRoute.ToString()

                };

                var response = viewRenderer.RenderView(context, "/Codes/Error.html", model);
                response.StatusCode = statusCode;
                context.Response = response;
            }
            catch (Exception)
            {

                RemoveCode((int)statusCode);
                context.Response.StatusCode = statusCode;
            }
        }