Пример #1
0
        public ActionResult Edit(Inverter postedModel)
        {
            if (!IsInverterOwner(postedModel.InverterId))
            ThrowNotAuthorizedException();

              if (ModelState.IsValid)
              {
            var inverterToUpdate = _plantRepository.GetInverter(postedModel.InverterId);

            // update inverter settings
            inverterToUpdate.EuroPerKwh = postedModel.EuroPerKwh;
            inverterToUpdate.Name = postedModel.Name;
            inverterToUpdate.ACPowerMax = postedModel.ACPowerMax;

            //store edited inverter
            _plantRepository.StoreInverter(inverterToUpdate);

            //notify user about success
            ViewData["Message"] = "Ihre Änderungen wurden übernommen.";
              }

              //reload inverter from repository
              var getModel = _plantRepository.GetInverter(postedModel.InverterId);

              return View("EditInverter", getModel);
        }
Пример #2
0
 public void StoreInverter(Inverter inverterToUpdate)
 {
     ProfiledWriteConnection.Execute( @"UPDATE inverter
       SET Name = @name
       , EuroPerKwh = @euroPerKwh
       , ACPowerMax = @aCPowerMax
       WHERE InverterId = @inverterId;", inverterToUpdate );
 }