Esempio n. 1
0
 public ActionResult Add(Content model)
 {
     if (ModelState.IsValid)
     {
         if (model.Id == 0)
         {
             _uow.ContentService.Add(model);
         }
         else {
             var old = _uow.ContentService.Get(t => t.Id == model.Id);
             if (old != null) {
                 old.Title = model.Title;
                 old.Description = model.Description;
                 old.LinkUrl = model.LinkUrl;
                 old.PicUrl = model.PicUrl;
                 old.AltName = model.AltName;
                 old.TagName = model.TagName;
                 old.ContentType = model.ContentType;
             }
         }
         _uow.Commit();
         //delete cache
         Ichari.Cache.CacheContainer<List<Content>>.DeleteByName("Content.GetList","zcdw_hzmt");
         return RedirectToAction("Index");
     }
     return View(model);
 }
Esempio n. 2
0
 /// <summary>
 /// 用于向 Content EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToContent(Content content)
 {
     base.AddObject("Content", content);
 }
Esempio n. 3
0
 /// <summary>
 /// 创建新的 Content 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="contentType">ContentType 属性的初始值。</param>
 public static Content CreateContent(global::System.Int32 id, global::System.Int32 contentType)
 {
     Content content = new Content();
     content.Id = id;
     content.ContentType = contentType;
     return content;
 }