Пример #1
0
        public ActionResult Update(string title, string Content, int type, int id)
        {
            if (string.IsNullOrWhiteSpace(title) || string.IsNullOrWhiteSpace(Content))
            {
                return(WriteError("标题或者内容不能为空!"));
            }
            model.SiteSet model = new model.SiteSet();
            model.id       = id;
            model.Contents = Content;
            model.Title    = title;
            model.Image    = GetImageUrl(Content);
            model.type     = type;
            if (id > 0)
            {
                siteService.Edit(model, new string[] { "Title", "Contents", "Image", "type" });
            }
            else
            {
                model.Creator   = "丰顺商会";
                model.CreatTime = DateTime.Now;
                model.Look      = 0;
                siteService.Add(model);
            }
            var result = siteService.SaveChanges();

            if (result > 0)
            {
                return(WriteSuccess("操作成功!"));
            }
            return(WriteError("操作失败!"));
        }
Пример #2
0
 public ActionResult GetModel(int id)
 {
     if (id > 0)
     {
         model.SiteSet model = siteService.QueryWhere(c => c.id == id).First();
         return(Json(model));
     }
     return(WriteError("参数错误!"));
 }
Пример #3
0
        public ActionResult UpdateDispay(int id, int look)
        {
            if (id <= 0)
            {
                return(WriteError("参数错误!请重新尝试"));
            }
            model.SiteSet model = new model.SiteSet();
            model.id   = id;
            model.Look = look;
            siteService.Edit(model, new string[] { "Look" });
            var result = siteService.SaveChanges();

            if (result > 0)
            {
                return(WriteSuccess("修改成功!"));
            }
            return(WriteError("修改失败!"));
        }