/// <summary> /// Creates an instance of BlockEditor viewModel for an existing fpcState model /// </summary> /// <param name="stateModel">state model to create a block (can be obtained from a different context)</param> public BlockEditorVm(Model.State stateModel) { _uow = new Dal.SoheilEdmContext(); _blockDataService = new DataServices.BlockDataService(_uow); Message = new Common.SoheilException.EmbeddedException(); var stateEntity = new Soheil.Core.DataServices.StateDataService(_uow).GetSingle(stateModel.Id); State = new StateVm(stateEntity); SelectedStateStation = State.StateStationList.FirstOrDefault(); EditorStartDate = DateTime.Now.Date; EditorStartTime = DateTime.Now.TimeOfDay; initOperatorManager(); initializeCommands(); }
/// <summary> /// Creates an instance of BlockEditor viewModel for an existing block model /// <para>Each instance has an exclusive uow</para> /// </summary> /// <param name="blockModel">block containing some (or no) tasks to edit (must be obtained from the same context)</param> public BlockEditorVm(Model.Block blockModel) { _isInitializing = true; _uow = new Dal.SoheilEdmContext(); _blockDataService = new DataServices.BlockDataService(_uow); Message = new Common.SoheilException.EmbeddedException(); //change context graph Model = _blockDataService.GetSingle(blockModel.Id); State = new StateVm(Model.StateStation.State); StateStation = State.StateStationList.First(x => x.StateStationId == Model.StateStation.Id); SelectedStateStation = StateStation; BlockTargetPoint = Model.BlockTargetPoint; initOperatorManager(); initTask(); initializeCommands(); _isInitializing = false; }
public HttpResponseMessage Get([FromUri] StateVm param) { var data = db.GetStates(param.StateName, param.UserId).ToList(); return(Request.CreateResponse(new ResponseData(data))); }