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); } }
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); }