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