public ActionResult ViewDetail(int id) { ContentRepository objcont = new ContentRepository(SessionCustom); UserRepository objuser = new UserRepository(SessionCustom); SectionRepository objSection = new SectionRepository(SessionCustom); ContentrelationRepository objrel = new ContentrelationRepository(SessionCustom); objrel.Entity.ContentId = id; objcont.Entity.ContentId = id; objcont.Load(); objuser.Entity.UserId = objcont.Entity.UserId; objuser.Load(); return(this.View(new InfoContent() { Content = objcont.Entity, Autor = objuser.Entity.Names, DeepFollower = Business.Utils.GetDeepFollower(objSection.GetAll(), objcont.Entity.SectionId.Value), CountContent = objrel.GetAllReadOnly().Count })); }
/// <summary> /// Attached or detached a contents /// </summary> /// <param name="contentId">identifier of content</param> /// <param name="contentIdChild">identifier of content child</param> /// <param name="attach">if the content attached</param> /// <returns>returns true if the operation is successful</returns> public bool AttachDettachContent(int contentId, int contentIdChild, bool attach) { try { ContentrelationRepository objrel = new ContentrelationRepository(this.session); objrel.Entity.ContentId = contentId; objrel.Entity.ContentIdChild = contentIdChild; if (attach) { objrel.Insert(); } else { objrel.Delete(); } return(true); } catch (Exception) { return(false); } }