Esempio n. 1
0
        public MetaTimeMachineUpdateResponse Update([FromBody] MetaTimeMachineUpdateRequest request)
        {
            MetaTimeMachineUpdateResponse response = new MetaTimeMachineUpdateResponse();

            if (request.Id == 0 || request.Id < 0)
            {
                response.Status = -1;
                return(response);
            }

            MetaTimeMachineEntity entity = metaTimeMachineRepository.GetById(request.Id);

            if (entity == null)
            {
                response.Status = 404;
                return(response);
            }

            metaTimeMachineRepository.Update(metaTimeMachineConvertor.toEntity(request, entity));

            theTimeMachineMeta.Refresh();

            response.Status = 1;
            return(response);
        }
Esempio n. 2
0
        public MetaTimeMachineEntity toEntity(MetaTimeMachineUpdateRequest request, MetaTimeMachineEntity oldEntity)
        {
            MetaTimeMachineEntity entity = new MetaTimeMachineEntity();

            entity.Id              = request.Id;
            entity.TimeMachineId   = request.TimeMachineId != null ? request.TimeMachineId.Value : 0;
            entity.TimeMachineName = request.TimeMachineName;

            return(entity);
        }