Exemplo n.º 1
0
 public string Add()
 {
     string publishDate = GetFormValue("PublishDate");
     Archive arc = new Archive()
     {
         Subject = GetFormValue("Subject"),
         Content = GetFormValue("Content"),
         CategoryId = Convert.ToInt32(GetFormValue("CategoryId")),
         PublishDate = string.IsNullOrEmpty(publishDate) ? DateTime.Now : Convert.ToDateTime(publishDate)
     };
     int result = Db.Insert<Archive>(arc);
     return result > 0 ? "OK" : "ERROR";
 }
Exemplo n.º 2
0
 /// <summary>
 /// 创建新的 Archive 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 public static Archive CreateArchive(global::System.Int64 id)
 {
     Archive archive = new Archive();
     archive.Id = id;
     return archive;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 用于向 Archive EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToArchive(Archive archive)
 {
     base.AddObject("Archive", archive);
 }