public async Task <ActionResult> Create(CategoryModel model) { if (ModelState.IsValid) { var category = new ArticleCategory(); category.title = model.title; category.sort = 99; category.status = 0; category.parentId = model.parentId; category.depth = model.parentId == 0 ? 0 : easonRepository.Get(model.parentId).depth + 1; category.creatorId = long.Parse((User.Identity as ClaimsIdentity).Claims.FirstOrDefault(m => m.Type == ClaimTypes.Sid).Value); category.creatorName = User.Identity.Name; category.creationTime = DateTime.Now; await easonRepository.InsertAsync(category); await easonRepository.UnitOfWork.CommitAsync(); return(RedirectToAction("Index")); } return(View(model)); }