コード例 #1
0
        //http://localhost:6491/Home/ClearLog

        public ActionResult ClearLog()
        {
            var vm = new ClearLogViewModel
            {
                PriorToDate = DateTime.Now.Subtract(new TimeSpan(30, 0, 0, 0))
            };

            return(View(vm));
        }
コード例 #2
0
        public ActionResult ClearLog(ClearLogViewModel vm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    PatService.DeleteLogItemsPriorTo(vm.PriorToDate);

                    TempData[CommonConstants.FlashMessageTypeInfo] = "Log cleared";

                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch (Exception ex)
            {
                ErrorLog.GetDefault(null).Log(new Error(ex));
                return(View("Error", new HandleErrorInfo(ex, "Home", "ClearLog")));
            }
            return(View(vm));
        }