예제 #1
0
        public JsonResult <object> EditArticle(ArticleRequest request)
        {
            var baseInfo = GetBaseInfo();

            if (request == null)
            {
                throw new Exception("请求数据不能为空");
            }

            _articleService.Edit(request.ToDomainModel());

            return(JsonNet("修改成功"));
        }
예제 #2
0
        public JsonResult <object> AddArticle(ArticleRequest request)
        {
            if (request == null)
            {
                return(JsonError("请求数据错误"));
            }
            var baseInfo = GetBaseInfo();
            var domain   = request.ToDomainModel();

            domain.ID         = Guid.NewGuid();
            domain.UID        = baseInfo.UID;
            domain.CreateTime = DateTime.Now;
            _articleService.NewCreate(domain);

            return(JsonNet("添加成功"));
        }