Example #1
0
        public void Test_GetId()
        {
            var instance = TimestampId.GetInstance();

            for (int i = 0; i < 1000; i++)
            {
                var result = instance.GetId().ToLong();
                Console.WriteLine(result);
            }
        }
        public IActionResult Index(ArticleViewModel vm)
        {
            switch (vm.ArticleAction)
            {
            case ArticleActionEnum.Add:
                vm.BlogArticle.Id         = Convert.ToInt64(TimestampId.GetInstance().GetId());
                vm.BlogArticle.CreateDate = DateTime.Now;
                vm.BlogArticle.CreateBy   = UserRuntimeContext.CurrentUser.UserName;
                _blogArticleService.Insert(vm.BlogArticle);
                break;

            case ArticleActionEnum.Edit:
                vm.BlogArticle.UpdateDate = DateTime.Now;
                vm.BlogArticle.UpdateBy   = UserRuntimeContext.CurrentUser.UserName;
                _blogArticleService.Update(vm.BlogArticle);
                break;
            }
            return(RedirectToAction("Index", "Home"));
        }
Example #3
0
        public void Test_GetId()
        {
            var result = TimestampId.GetInstance().GetId();

            Console.WriteLine(result);
        }