public ActionResult TblNewsDraffUpdate(long id, TblNewsDraffModel model, List <string> fileattach) { try { TblNewsDraff o = new TblNewsDraff(); o.NewsId = id; o.Title = model.title; o.GroupNewsId = model.groupnews; o.ShortContent = model.shortcontent; o.Content = model.content; o.BigImage = model.image; o.IsHome = model.ishome; o.IsEvent = model.isevent; o.IsWeek = model.isweek; o.EditUser = GetUserName(); o.EditDate = DateTime.Now; string urlseo = (new Rewrite().RemoveUnicode(model.title)).Replace(" ", "-").Replace("?", "").Replace(":", "").Replace(",", "").Replace("\"", string.Empty).Trim().Replace("'", "").Replace("/", "").Replace("[", "").Replace("]", "").Replace("(", "").Replace(")", "").Replace("[^0-9a-zA-Z]+", "").ToLower(); o.Metatitle = urlseo; new TblNewsDraffDao().Update(o); SetAlert("cập nhật thành công", "success"); return(RedirectToAction("TblNewsDraffUpdate")); } catch (Exception ex) { logger.Info(ControllerName + "::TblNewsDraffUpdate::" + ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult TblNewsDraffCreate(string title, TblNewsDraffModel model, List <string> fileattach, string image = "/Images/defaultimage.jpg", string groupname = "TRƯỜNG HỌC", bool ishome = false, bool isevent = false, bool isweek = false) { try { TblNewsDraff o = new TblNewsDraff(); TblFileNewsDraff obj = new TblFileNewsDraff(); o.Title = title; o.GroupNewsId = new TblGroupNewsDao().FindByName(groupname).GroupNewsId; o.ShortContent = model.shortcontent; o.Content = model.content; o.BigImage = image; o.IsHome = ishome; o.IsEvent = isevent; o.IsWeek = isweek; o.CreateUser = this.GetUserName(); o.CreateDate = DateTime.Now; o.Metatitle = (new Rewrite().RemoveUnicode(title)).Replace(" ", "-").Replace("?", "").Replace(":", "").Replace(",", "").Replace("\"", string.Empty).Trim().Replace("'", "").Replace("/", "").Replace("[", "").Replace("]", "").Replace("(", "").Replace(")", "").Replace("[^0-9a-zA-Z]+", "").ToLower(); new TblNewsDraffDao().Create(o); var res = new TblNewsDraffDao().FindByTitle(title); foreach (var item in fileattach) { obj.NewsId = res.NewsId; obj.FileId = new TblFileDao().FindByName(item).Id; new TblFileNewsDraffDao().Create(obj); } return(Json(JsonRequestBehavior.AllowGet)); } catch (Exception ex) { logger.Info(ControllerName + "::TblNewsDraffCreate::" + ex.Message); return(RedirectToAction("Index", "Error")); } }
public ActionResult TblCommentAdminCreate(long newsid, string uck, TblNewsDraffModel model) { try { TblComment o = new TblComment(); o.Name = GetUserName(); o.Content = model.Comment; o.NewsId = newsid; o.CreateDate = DateTime.Now; o.IsAd = true; new TblCommentDao().Create(o); return(RedirectToAction("TblNewsDraffUpdate", "Admin", new { id = newsid })); } catch (Exception ex) { logger.Info(ControllerName + "::TblCommentAdminCreate::" + ex.Message); return(RedirectToAction("Index", "Error")); } }