[training]ASP.NET MVC 5 – Entity Framework 1

namespace WebApplication1.Models  {      public class GuestbookDB      {          GuestbookEntities1 db = new GuestbookEntities1();          //GuestbookEntities1: 資料庫,如一個公司別的資料庫            public void Create(string name, string content)          {              Contents NewData = new Contents();              //Contents: 資料庫底下的一個Table                NewData.name = name;              NewData.content = content;                db.Contents.Add(NewData);              db.SaveChanges();          }          public void Create(Contents NewData)          {              db.Contents.Add(NewData);              db.SaveChanges();          }      }  }  

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.