예제 #1
0
 public ActionResult AddReasonForDisarming(ReasonForDisarmingViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (SensorDryRepository.SetReasonForDisarming(model.SensorDryId, model.Reason, UserId)
         && SensorDryRepository.SensorDryUpdateStatus(model.SensorDryId, 0))
             return Content("OK");
         else
             ModelState.AddModelError("", "Не удалось сохранить в базу данных!");
         return PartialView("ReasonForDisarming", model);
     }
     else
     {
         return PartialView("ReasonForDisarming", model);
     }
 }
예제 #2
0
 public PartialViewResult ReasonForDisarming(int sensorId)
 {
     SensorDry SensorDry = SensorDryRepository.GetById(sensorId);
     House house = HouseRepository.GetBySensorId(sensorId);
     ReasonForDisarmingViewModel model = new ReasonForDisarmingViewModel();
     model.UserId = UserId;
     model.HouseId = house.Id;
     model.Door = SensorDry.Door1.Name;
     model.SensorDryId = SensorDry.Id;
     return PartialView(model);
 }