예제 #1
0
        public ActionResult Add(string Title, string PicUrl)
        {
            AjaxResponse<ArticleDisPhoto> obj = new AjaxResponse<ArticleDisPhoto>();

            if (string.IsNullOrEmpty(Title))
            {
                obj.ErrorMessage = "展图名称不能为空";
                return Json(obj);
            }
            if (string.IsNullOrEmpty(PicUrl))
            {
                obj.ErrorMessage = "展图路径不能为空";
                return Json(obj);
            }
            if (Title.Length > 15)
            {
                obj.ErrorMessage = "展图名称不能超过15个字";
                return Json(obj);
            }

            ArticleDisPhoto ArticleDisPhoto = new ArticleDisPhoto { Title = Title, PicUrl = PicUrl, Status = StatusEnum.Normal };

            obj.IsSuccess = ArticleDisPhotoService.AddModel(ArticleDisPhoto);
            return Json(obj);
        }
예제 #2
0
        public JsonResult Update(int Status, string Title, string PicUrl, int Id = 0)
        {
            AjaxResponse<ArticleDisPhoto> obj = new AjaxResponse<ArticleDisPhoto>();

            if (string.IsNullOrEmpty(Title))
            {
                obj.ErrorMessage = "展图名称不能为空";
                return Json(obj);
            }
            if (string.IsNullOrEmpty(PicUrl))
            {
                obj.ErrorMessage = "展图路径不能为空";
                return Json(obj);
            }
            if (Title.Length > 15)
            {
                obj.ErrorMessage = "展图名称不能超过15个字";
                return Json(obj);
            }

            ArticleDisPhoto ArticleDisPhoto = new ArticleDisPhoto { Id = Id, Title = Title, PicUrl = PicUrl, Status = Status != 99 ? StatusEnum.Normal : StatusEnum.Delete };

            obj.IsSuccess = ArticleDisPhotoService.UpdateModel(ArticleDisPhoto);

            return Json(obj);
        }