Пример #1
0
        public ActionResult Delete(string id)
        {
            string query = string.Format("&appid={0}&tabid={1}", Request.QueryString["appid"], Request.QueryString["tabid"]);

            RoadFlow.Data.Model.ArticleModel model = new RoadFlow.Data.Model.ArticleModel();
            model.Status = 255; //状态为无效
            articleDB.Update(model, id.Convert <Guid>());
            //ViewBag.Script = "alert('删除成功!;new RoadUI.Window().reloadOpener();)";
            return(RedirectToAction("Index", new { appid = Request["appid"] }));
        }
Пример #2
0
 public ActionResult Index(RoadFlow.Data.Model.ArticleModel model)
 {
     //文章类型
     if (model.Title.IsNullOrEmpty() || model.BriefIntroduction.IsNullOrEmpty() || model.PublishTime == null || model.Content.IsNullOrEmpty())
     {
         ViewBag.Script = "alert('不能为空!')";
         return(View());
     }
     else
     {
         articleDB.Add(model);
         ViewBag.Script = "alert('发布成功!')";
     }
     return(View(new ArticleIndexViewModel()
     {
         Model = model, ArticleTypes = dicDB.GetArticleType()
     }));
 }
Пример #3
0
        public ActionResult Edit([Bind(Exclude = "Id")] RoadFlow.Data.Model.ArticleModel model, string id)
        {
            //文章类型
            //DataTable articleType = dicDB.GetArticleType();
            //ViewBag.Type = articleType;

            string query = string.Format("&appid={0}&tabid={1}", Request.QueryString["appid"], Request.QueryString["tabid"]);
            int    rows  = articleDB.Update(model, id.Convert <Guid>());

            if (rows > 0)
            {
                return(RedirectToAction("Index", new { appid = Request["appid"] }));
            }
            //ViewBag.Script = "alert('修改成功!;new RoadUI.Window().reloadOpener();)";
            return(View(new ArticleManageEditViewModel
            {
                ArticleTypes = dicDB.GetArticleType(),
                ArticleModel = model,
                Script = "alert(\"修改失败!\");"
            }));
        }
Пример #4
0
 public int Update(RoadFlow.Data.Model.ArticleModel model, Guid?id)
 {
     return(baseDb.Update <RoadFlow.Data.Model.ArticleModel>(model, new KeyValuePair <string, object>("Id", id)));
 }
Пример #5
0
 public int Add(RoadFlow.Data.Model.ArticleModel model)
 {
     return(baseDb.Add <RoadFlow.Data.Model.ArticleModel>(model));
 }