示例#1
0
 public IActionResult SetCredentials(SetCredentialsViewModel model)
 {
     if (ModelState.IsValid)
     {
         var credentials = new Credentials
         {
             HassBaseUrl      = model.HassBaseUrl,
             HassPassword     = model.HassPassword,
             DarkSkyApiKey    = model.DarkSkyApiKey,
             SlRealTimeApiKey = model.SlRealTimeApiKey,
             MqttPassword     = model.MqttPassword,
             MqttBroker       = model.MqttBroker,
             MqttUsername     = model.MqttUsername
         };
         _credentialsRepo.SetCredentials(credentials);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(model));
 }