public ActionResult Register(RegisterViewModel registerViewModel) { if (ModelState.IsValid) { IUserBLL userBLL = new UserBLL(); if (userBLL.Register(registerViewModel.Email, registerViewModel.Password)) { Guid userId; userBLL.Login(registerViewModel.Email, registerViewModel.Password, out userId); // create default category and article in the account IArticleBLL articleBLL = new ArticleBLL(); articleBLL.CreateCategory("default", userId); List <Guid> categoryIds = new List <Guid>(); foreach (CategoryDTO categoryDTO in articleBLL.GetAllCategories(userId)) { categoryIds.Add(categoryDTO.Id); } articleBLL.CreateArticle("default title", "default content", categoryIds.ToArray(), userId); return(RedirectToAction(nameof(Login))); } return(View(registerViewModel)); } return(View(registerViewModel)); }
public ActionResult CategoryList() { IArticleBLL articleBLL = new ArticleBLL(); return(View(articleBLL.GetAllCategories(Guid.Parse(Session["loginUserId"].ToString())))); }