Example #1
0
    public static ServerRegistration BuildEntity(ServerRegistrationDto dto)
    {
        var model = new ServerRegistration(dto.Id, dto.ServerAddress, dto.ServerIdentity, dto.DateRegistered, dto.DateAccessed, dto.IsActive, dto.IsSchedulingPublisher);

        // reset dirty initial properties (U4-1946)
        model.ResetDirtyProperties(false);
        return(model);
    }
        public ServerRegistration BuildEntity(ServerRegistrationDto dto)
        {
            var model = new ServerRegistration(dto.Id, dto.ServerAddress, dto.ServerIdentity, dto.DateRegistered, dto.DateAccessed, dto.IsActive, dto.IsMaster);

            //on initial construction we don't want to have dirty properties tracked
            // http://issues.umbraco.org/issue/U4-1946
            model.ResetDirtyProperties(false);
            return(model);
        }
    protected override void PersistUpdatedItem(IServerRegistration entity)
    {
        entity.UpdatingEntity();

        ServerRegistrationDto dto = ServerRegistrationFactory.BuildDto(entity);

        Database.Update(dto);

        entity.ResetDirtyProperties();
    }
    protected override void PersistNewItem(IServerRegistration entity)
    {
        entity.AddingEntity();

        ServerRegistrationDto dto = ServerRegistrationFactory.BuildDto(entity);

        var id = Convert.ToInt32(Database.Insert(dto));

        entity.Id = id;

        entity.ResetDirtyProperties();
    }
Example #5
0
    public static ServerRegistrationDto BuildDto(IServerRegistration entity)
    {
        var dto = new ServerRegistrationDto
        {
            ServerAddress         = entity.ServerAddress,
            DateRegistered        = entity.CreateDate,
            IsActive              = entity.IsActive,
            IsSchedulingPublisher = ((ServerRegistration)entity).IsSchedulingPublisher,
            DateAccessed          = entity.UpdateDate,
            ServerIdentity        = entity.ServerIdentity,
        };

        if (entity.HasIdentity)
        {
            dto.Id = entity.Id;
        }

        return(dto);
    }