コード例 #1
0
        public ControllerStateHistory ReplaceState(ISqLiteContext ctx, Models.ControllerStateInformation newStateModel, Models.ControllerStateInformation oldStateModel)
        {
            var newState = _entityFactory.CreateControllerStateInformation(newStateModel);
            var oldState = _entityFactory.CreateControllerStateInformation(oldStateModel);

            var terminationDate = TerminateState(ctx, oldState);

            return(ActivateState(ctx, newState, terminationDate));
        }
コード例 #2
0
        public Models.ControllerStateHistory ReplaceState(Models.ControllerStateInformation newStateModel, Models.ControllerStateInformation oldStateModel)
        {
            using (var ctx = _repositoryService.GetContext())
            {
                var history = ReplaceState(ctx, newStateModel, oldStateModel);
                ctx.SaveChanges();

                return(_modelFactory.CreateControllerStateHistory(history));
            }
        }
コード例 #3
0
 public ControllerStateInformation CreateControllerStateInformation(Models.ControllerStateInformation controllerStateInformation)
 {
     return(new ControllerStateInformation()
     {
         //Controller
         ControllerId = controllerStateInformation.ControllerId,
         Id = controllerStateInformation.Id,
         PowerConsumption = controllerStateInformation.PowerConsumption,
         State = controllerStateInformation.State
     });
 }