// GET: Camera/Create public ActionResult Create() { var model = new CameraViewModels { _weekdaysList = new List <SelectListItem> { new SelectListItem { Value = "Sunday", Text = "Sunday" }, new SelectListItem { Value = "Monday", Text = "Monday" }, new SelectListItem { Value = "Tuesday", Text = "Tuesday" }, new SelectListItem { Value = "Wednesday", Text = "Wednesday" }, new SelectListItem { Value = "Thursday", Text = "Thursday" }, new SelectListItem { Value = "Friday", Text = "Friday" }, new SelectListItem { Value = "Saturday", Text = "Saturday" }, } }; // the list of available values return(View(model)); }
public ActionResult DeleteConfirmed(int id) { CameraViewModels cameraViewModels = db.CameraViewModels.Find(id); db.CameraViewModels.Remove(cameraViewModels); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CameraId,Name,Make,Model,From,To,LiveView,ExtrernalLink,Status,VideoSpeed,ContinuousLoop")] CameraViewModels cameraViewModels) { if (ModelState.IsValid) { db.Entry(cameraViewModels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cameraViewModels)); }
// GET: Camera/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CameraViewModels cameraViewModels = db.CameraViewModels.Find(id); if (cameraViewModels == null) { return(HttpNotFound()); } return(View(cameraViewModels)); }
public DTMainViewModel() : base() { CameraViewModels.Add(new DTCameraViewModel()); SelectedCameraViewModel = CameraViewModels.FirstOrDefault(); }
/// <summary> /// Initializes a new instance of the AllCamerasViewModel class. /// </summary> public CamerasViewModel() { CamerasModel.Name = "all"; CamerasModel.Cameras = new ObservableCollection<CameraModel>(); CamerasModel.Controllers = new ObservableCollection<MotionControllerModel>(); Refresh(); MultipleViewsService = new MultipleViewsService(); MultipleViewsService.Initialize(_camerasModel, CameraViewModels.Select(camera => camera.TrackerService).ToList()); Messenger.Default.Register<AddCameraMessage>(this, message => { CameraViewModel cvm = SimpleIoc.Default.GetInstance<CameraViewModel>(message.Camera.GUID); CameraViewModels.Add(cvm); CamerasModel.Cameras.Add(cvm.Camera); MultipleViewsService.TrackerServices.Add(cvm.TrackerService); }); Messenger.Default.Register<RemoveCameraMessage>(this, message => { if(SimpleIoc.Default.ContainsCreated<CameraViewModel>(message.Camera.GUID)) { CameraViewModel cvm = SimpleIoc.Default.GetInstance<CameraViewModel>(message.Camera.GUID); CameraViewModels.Remove(cvm); CamerasModel.Cameras.Remove(cvm.Camera); MultipleViewsService.TrackerServices.Remove(cvm.TrackerService); } }); Messenger.Default.Register<AddMotionControllerMessage>(this, message => { CamerasModel.Controllers.Add(message.MotionController); }); Messenger.Default.Register<RemoveMotionControllerMessage>(this, message => { CamerasModel.Controllers.Remove(message.MotionController); }); if(IsInDesignMode) { CamerasModel.Cameras.Add(new CameraViewModel().Camera); CamerasModel.Cameras.Add(new CameraViewModel().Camera); CamerasModel.Cameras.Add(new CameraViewModel().Camera); CamerasModel.Cameras.Add(new CameraViewModel().Camera); CamerasModel.Controllers.Add(new MotionControllerModel()); CamerasModel.Controllers.Add(new MotionControllerModel()); } else { if (SimpleIoc.Default.GetInstance<SettingsViewModel>().Settings.LoadCamerasOnStartup) { AddAvailableCameras(); } if(SimpleIoc.Default.GetInstance<SettingsViewModel>().Settings.Debug) { new CameraViewModel(); new CameraViewModel(); new CameraViewModel(); new CameraViewModel(); } } }