public ActionResult Create() { ViewBag.ddlCategory = getddlCategory(); ArticleCRUD model = new ArticleCRUD(); return(View(model)); }
/// <summary> /// Create an Article and insert it in the DB /// </summary> /// <param name="blogID">Id of the blog containing the T_Article.</param> /// <param name="mediaUrl">Link to the media includes into the article, or text if the media is a quote.</param> /// <param name="mediaTypeId">Type of the media.</param> /// <param name="text">A caption for the media, or the content of the article if there is no media.</param> /// <param name="tags">The tags, separated by a space</param> /// <returns>Nothing</returns> public static void Create(long blogID, String mediaUrl, long mediaTypeId, String text, String tags) { T_Article article = new T_Article() { BlogId = blogID, MediaUrl = mediaUrl, MediaTypeId = mediaTypeId, Text = text, CreationDate = DateTime.Now }; List <T_Tag> newtags = new List <T_Tag>(); if (!String.IsNullOrEmpty(tags)) { string[] tabTags = tags.Split(new Char[] { ' ' }); foreach (string tag in tabTags) { newtags.Add(new T_Tag() { Name = tag }); } } ArticleCRUD.CreateAndAddTags(article, newtags); }
public JsonResult Edit(ArticleCRUD model) { rs r; using (var trans = new TransactionScope()) { try { var entity = _ArticleServ.SingleOrDefault(s => s.Id == model.Id); entity.CategoryId = model.CategoryId; entity.Title = model.Title; entity.Content = model.Content; entity.ImageThumbnail = model.ImageThumbnail; entity.SEOTitle = model.SEOTitle; entity.Description = model.Description; entity.FontAwesomeIcon = model.FontAwesomeIcon; _ArticleServ.Save(); trans.Complete(); r = rs.T("Okay"); } catch (Exception ex) { r = rs.F("Lỗi: " + ex.Message); } } return(Json(r, JsonRequestBehavior.DenyGet)); }
public JsonResult ReplyList(ArticleAjax m) { int skip = m.PageSize * (m.PageCurrent - 1); int take = m.PageSize; IEnumerable <Reply> query = ArticleCRUD.ReplyQuery(m.AuthorSearch, m.Cate, m.Date, m.Report, m.Keyword); int count = query.Count(); if (count == 0) { return(Json(new { })); } int changepage = 0; if (count <= skip) { changepage = (int)Math.Ceiling((decimal)count / take); skip = take * (changepage - 1); } IEnumerable <Reply> replies = query.SkipTake(skip, take); IEnumerable <ReplyJson> jsons = replies.Select(reply => new ReplyJson { Count = count, ChangePage = changepage, reply = reply, reports = db.Reply_Report }); return(Json(jsons)); }
public async Task <EmptyResult> ArticleReplyDelete(int id, string message, string type, int arid) { int adminId = (Session[CDictionary.SK_Admin_Logined_Member] as Member).MemberID; await ArticleCRUD.DeleteWithMessage(id, message, type, arid, adminId); return(new EmptyResult()); }
public ActionResult Edit(int id) { Article entity = _ArticleServ.GetEntry(id); ArticleCRUD vm = new ArticleCRUD(); vm.Id = entity.Id; ViewBag.ddlCategory = getddlCategory(); vm.CategoryId = entity.CategoryId; vm.Title = entity.Title; vm.Content = entity.Content; vm.ImageThumbnail = entity.ImageThumbnail; vm.SEOTitle = entity.SEOTitle; vm.Description = entity.Description; vm.FontAwesomeIcon = entity.FontAwesomeIcon; return(View(vm)); }
public JsonResult Create(ArticleCRUD model) { rs r; try { Article entity = new Article(); entity.CategoryId = model.CategoryId; entity.Title = model.Title; entity.Content = model.Content; entity.ImageThumbnail = model.ImageThumbnail; entity.SEOTitle = model.SEOTitle; entity.Description = model.Description; entity.FontAwesomeIcon = model.FontAwesomeIcon; __db.Article.Add(entity); __db.SaveChanges(); r = rs.T("Okay"); } catch (Exception ex) { r = rs.F("Lỗi: " + ex.Message); } return(Json(r, JsonRequestBehavior.DenyGet)); }
public void Delete(long articleId) { ArticleCRUD.Delete(articleId); }
public static T_Article Get(long articleId) { return(ArticleCRUD.Get(articleId)); }
public List <T_Article> GetWithBlog(long blogId) { return(ArticleCRUD.GetWithBlog(blogId)); }
public static Dbo.Article GetArticleDbo(long articleId) { return(ArticleCRUD.GetArticleDbo(articleId)); }
public bool ArticleReplyConfirm(int id) { return(ArticleCRUD.ArticleReplyConfirmIsReport(id)); }
public ActionResult GetList(BsTableRequestModel param) { var en = new ArticleCRUD(db); return(Json(en.GetList(param))); }