Esempio n. 1
0
        public bool UpdateDomain(string ID, string domain, int port)
        {
            if (domain == null)
            {
                domain = "";
            }
            else
            {
                domain = domain.Trim();
            }

            blog_tb_domain entity = Dal.GetDomainEntity(ID);

            if (entity == null)
            {
                throw new CustomException("绑定不存在");
            }

            blog_tb_domain entity2 = Dal.QueryDomain(entity.blogID + "", domain, port);

            if (entity2 != null && entity2.ID != entity.ID)
            {
                throw new CustomException("绑定已存在");
            }

            entity.domain      = domain;
            entity.port        = port;
            entity.UPDATE_DATE = DateTime.Now;

            return(Dal.UpdateDomain(entity) > 0);
        }
Esempio n. 2
0
        public bool AddDomain(string blogID, string domain, int port)
        {
            blog_tb_domain entity = Dal.QueryDomain(blogID, domain, port);

            if (entity != null)
            {
                throw new CustomException("该绑定已存在");
            }

            entity             = new blog_tb_domain();
            entity.ID          = Guid.NewGuid().ToString("N");
            entity.blogID      = Convert.ToInt32(blogID);
            entity.ADD_DATE    = DateTime.Now;
            entity.UPDATE_DATE = DateTime.Now;
            entity.domain      = domain;
            entity.port        = port;
            return(Dal.AddDomain(entity) > 0);
        }
Esempio n. 3
0
        public int UpdateDomain(blog_tb_domain entity)
        {
            IDbHelper db = IocFactory <IDbFactory> .Instance.GetDbInstance("Blogs-Write");

            return(EntityHelper <blog_tb_domain> .Update(entity, "blog_tb_domain", db, "ID"));
        }
Esempio n. 4
0
        public int AddDomain(blog_tb_domain entity)
        {
            IDbHelper db = IocFactory <IDbFactory> .Instance.GetDbInstance("Blogs-Write");

            return(EntityHelper <blog_tb_domain> .Insert(entity, "blog_tb_domain", "ID", true, db));
        }