コード例 #1
0
        public blog_Table Add(blog_Table entity)
        {
            blog_Table blog = new blog_Table();

            blog.Title    = entity.Title;
            blog.Synopsis = entity.Synopsis;
            blog.Content  = entity.Content;
            blog.Image    = entity.Image;
            blog.DateTime = entity.DateTime;

            blog.Star          = entity.Star;
            blog.Module        = entity.Module;
            blog.View_number   = entity.View_number;
            blog.Like_number   = entity.Like_number;
            blog.Comment_numbe = entity.Comment_numbe;
            db.blog_Table.Add(blog);
            if (db.SaveChanges() > 0)
            {
                return(entity);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        public comment_Table Add(comment_Table entity)
        {
            comment_Table com = new comment_Table();

            com.BlogID      = entity.BlogID;
            com.Content     = entity.Content;
            com.DateTime    = entity.DateTime;
            com.Name        = entity.Name;
            com.Phonenumber = entity.Phonenumber;
            db.comment_Table.Add(com);
            if (db.SaveChanges() > 0)
            {
                return(entity);
            }
            return(null);
        }
コード例 #3
0
        public administrator_Table Add(administrator_Table entity)
        {
            administrator_Table ad = new administrator_Table();

            ad.UserName    = entity.UserName;
            ad.Password    = entity.Password;
            ad.Name        = entity.Name;
            ad.Image       = entity.Image;
            ad.Phonenumber = entity.Phonenumber;
            ad.Email       = entity.Email;
            db.administrator_Table.Add(ad);
            if (db.SaveChanges() > 0)
            {
                return(entity);
            }
            return(null);
        }