title: ASP.NET Core appsettings.json update in code
body: <p>I am currently working on project using asp.net core v1.1, and in my appsettings.json I have:</p>
  
  <pre><code>"AppSettings": {
     "AzureConnectionKey": "***",
     "AzureContainerName": "**",
     "NumberOfTicks": 621355968000000000,
     "NumberOfMiliseconds": 10000,
     "SelectedPvInstalationIds": [ 13, 137, 126, 121, 68, 29 ],
     "MaxPvPower": 160,
     "MaxWindPower": 5745.35
  },
  </code></pre>
  
  <p>I also have class that I use to store them:</p>
  
  <pre><code>public class AppSettings
  {
      public string AzureConnectionKey { get; set; }
      public string AzureContainerName { get; set; }
      public long NumberOfTicks { get; set; }
      public long NumberOfMiliseconds { get; set; }
      public int[] SelectedPvInstalationIds { get; set; }
      public decimal MaxPvPower { get; set; }
      public decimal MaxWindPower { get; set; }
  }
  </code></pre>
  
  <p>And DI enabled to use then in Startup.cs:</p>
  
  <pre><code>services.Configure&lt;AppSettings&gt;(Configuration.GetSection("AppSettings"));
  </code></pre>
  
  <p><strong>Is there any way to change and save <code>MaxPvPower</code> and <code>MaxWindPower</code> from Controller?</strong></p>
  
  <p>I tried using</p>
  
  <pre><code>private readonly AppSettings _settings;
  
  public HomeController(IOptions&lt;AppSettings&gt; settings)
  {
      _settings = settings.Value;
  }
  
  [Authorize(Policy = "AdminPolicy")]
   public IActionResult UpdateSettings(decimal pv, decimal wind)
   {
      _settings.MaxPvPower = pv;
      _settings.MaxWindPower = wind;
  
      return Redirect("Settings");
   }
  </code></pre>
  
  <p>But it did nothing.</p>