File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed
OneTrueError.Data.Common/Configuration/Database
OneTrueError.Web/Areas/Admin Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ public class DatabaseStore : ConfigurationStore
1616 {
1717 private readonly Dictionary < Type , Wrapper > _items = new Dictionary < Type , Wrapper > ( ) ;
1818
19-
2019 /// <summary>
2120 /// Load a settings section
2221 /// </summary>
@@ -28,7 +27,9 @@ public override T Load<T>()
2827 {
2928 Wrapper t ;
3029 if ( _items . TryGetValue ( typeof ( T ) , out t ) && ! t . HasExpired ( ) )
31- return ( T ) t . Value ;
30+ {
31+ return ( T ) t . Value ;
32+ }
3233 }
3334
3435 var section = new T ( ) ;
@@ -88,11 +89,11 @@ public override void Store(IConfigurationSection section)
8889 }
8990 }
9091
91- private void SetCache < T > ( T section )
92+ private void SetCache ( IConfigurationSection section )
9293 {
9394 lock ( _items )
9495 {
95- _items [ typeof ( T ) ] = new Wrapper { AddedAtUtc = DateTime . UtcNow , Value = section } ;
96+ _items [ section . GetType ( ) ] = new Wrapper { AddedAtUtc = DateTime . UtcNow , Value = section } ;
9697 }
9798 }
9899
Original file line number Diff line number Diff line change 33using System . Linq ;
44using System . Web ;
55using System . Web . Mvc ;
6+ using log4net ;
67using OneTrueError . App . Core . Reports . Config ;
78using OneTrueError . Infrastructure . Configuration ;
89using OneTrueError . Web . Areas . Admin . Models ;
@@ -11,6 +12,8 @@ namespace OneTrueError.Web.Areas.Admin.Controllers
1112{
1213 public class ReportingController : Controller
1314 {
15+ private ILog _logger = LogManager . GetLogger ( typeof ( ReportingController ) ) ;
16+
1417 [ HttpGet ]
1518 public ActionResult Index ( )
1619 {
@@ -19,9 +22,10 @@ public ActionResult Index()
1922 if ( settings == null || settings . MaxReportsPerIncident == 0 )
2023 return View ( model ) ;
2124
25+ _logger . Debug ( "Display acess: " + settings . MaxReportsPerIncident + " from " + ConfigurationStore . Instance . GetHashCode ( ) ) ;
2226 model . MaxReportsPerIncident = settings . MaxReportsPerIncident ;
2327 model . RetentionDays = settings . RetentionDays ;
24- return View ( ) ;
28+ return View ( model ) ;
2529 }
2630
2731 [ HttpPost ]
@@ -35,9 +39,11 @@ public ActionResult Index(ReportingViewModel model)
3539 MaxReportsPerIncident = model . MaxReportsPerIncident ,
3640 RetentionDays = model . RetentionDays ,
3741 } ;
42+ _logger . Debug ( "Storing: " + settings . MaxReportsPerIncident ) ;
3843 ConfigurationStore . Instance . Store ( settings ) ;
44+ _logger . Debug ( "Stored: " + settings . MaxReportsPerIncident + " to " + ConfigurationStore . Instance . GetHashCode ( ) ) ;
3945
40- return View ( ) ;
46+ return RedirectToAction ( "Index" , "Home" ) ;
4147 }
4248 }
4349}
Original file line number Diff line number Diff line change 66 <div class =" col-lg-6" >
77
88 <h2 >Base configuration</h2 >
9- <form method =" post" action =" @Url.Action(" Basics " )" style =" width : 100% " class =" form" >
9+ <form method =" post" action =" @Url.Action(" Index " )" style =" width : 100% " class =" form" >
1010 @Html.ValidationSummary(false)
1111 <div class =" form-group" >
1212 <label class =" control-label" >
You can’t perform that action at this time.
0 commit comments