Exemple #1
0
 /// <summary>
 /// 插入上传文件
 /// </summary>
 /// <param name="Newuploadfile"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertUploadFile(UploadFile NewUploadFile, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewUploadFile, OwnerId));
 }
Exemple #2
0
 /// <summary>
 /// 插入用户动作
 /// </summary>
 /// <param name="Newstock"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertStock(Stock NewStock, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewStock, OwnerId));
 }
 /// <summary>
 /// 插入文集
 /// </summary>
 /// <param name="Newcollection"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertCollection(Collection NewCollection, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewCollection, OwnerId));
 }
Exemple #4
0
 /// <summary>
 /// 插入文章MarkDown内容
 /// </summary>
 /// <param name="NewArticleContent"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertArticleContent(ArticleContent NewArticleContent, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewArticleContent, OwnerId));
 }
Exemple #5
0
 /// <summary>
 /// 插入文章
 /// </summary>
 /// <param name="Newarticle"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertArticle(Article NewArticle, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewArticle, OwnerId));
 }
 /// <summary>
 /// 插入用户动作
 /// </summary>
 /// <param name="Newfocus"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertFocus(Focus NewFocus, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewFocus, OwnerId));
 }
Exemple #7
0
 /// <summary>
 /// 插入专题
 /// </summary>
 /// <param name="Newtopic"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertTopic(Topic NewTopic, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewTopic, OwnerId));
 }
        public ActionResult CollectionEdit(FormCollection collection)
        {
            if (Session[ConstHelper.Session_USERID] == null)
            {
                return(Redirect("/Home/Index"));
            }
            string     ownerId        = Session[ConstHelper.Session_USERID].ToString();
            string     CollectionId   = Request.QueryString["CollectionId"];
            Collection EditCollection = null;

            EditCollection = new Collection()
            {
                OwnerId       = ownerId,
                Title         = collection[nameof(Collection.Title)].Trim(),
                CustomTagList = collection[nameof(Collection.CustomTagList)].Trim(),
                Description   = collection[nameof(Collection.Description)].Trim(),
                IsSerie       = collection[nameof(Collection.IsSerie)] != null,
            };
            ViewData.Model = EditCollection;
            if (string.IsNullOrEmpty(CollectionId))
            {
                ViewBag.Title = "新建文集";
            }
            else
            {
                ViewBag.Title = "修改文集";
            }
            if (string.IsNullOrEmpty(EditCollection.Description))
            {
                ViewData.ModelState.AddModelError(nameof(Collection.Description), "请填写简介");
                return(View());
            }
            if (EditCollection.Description.Length < 15)
            {
                ViewData.ModelState.AddModelError(nameof(Collection.Description), "简介字数过少");
                return(View());
            }
            EditCollection.TagName = TagUtility.GetTagNameList(EditCollection.Title, EditCollection.CustomTagList);
            if (string.IsNullOrEmpty(CollectionId))
            {
                //新建文集时,不允许设置同名文集
                if (Collection.ExistCollectionByTitle(EditCollection.Title, EditCollection.OwnerId))
                {
                    ViewData.ModelState.AddModelError(nameof(Collection.Title), "文集名称已经存在");
                    return(View());
                }
                ViewBag.Title = "新建文集";
                CollectionId  = OwnerTableOperator.InsertRec(EditCollection, ownerId);
            }
            else
            {
                var OldCollection = Collection.GetCollectionBySn(CollectionId);
                OldCollection.Title         = EditCollection.Title;
                OldCollection.Description   = EditCollection.Description;
                OldCollection.IsSerie       = EditCollection.IsSerie;
                OldCollection.CustomTagList = EditCollection.CustomTagList;

                if (OldCollection.CreateDateTime == System.DateTime.MinValue)
                {
                    //修复以前BUG的问题
                    OldCollection.CreateDateTime = System.DateTime.Now;
                    OldCollection.CreateUser     = MongoDbRepository.UserSystem;
                }
                ViewBag.Title = "修改文集";
                MongoDbRepository.UpdateRec(OldCollection);
            }
            return(Redirect("/PostEdit/PostList?CollectionId=" + CollectionId));
        }
 /// <summary>
 /// 插入评论
 /// </summary>
 /// <param name="Newcomment"></param>
 /// <param name="OwnerId"></param>
 /// <returns>序列号</returns>
 public static string InsertComment(Comment NewComment, string OwnerId)
 {
     return(OwnerTableOperator.InsertRec(NewComment, OwnerId));
 }