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 CreateCategory(CreateCategoryViewModel createCategoryViewModel)
 {
     if (ModelState.IsValid)
     {
         IArticleBLL articleBLL = new ArticleBLL();
         articleBLL.CreateCategory(createCategoryViewModel.CategoryName, Guid.Parse(Session["loginUserId"].ToString()));
         // redirect to category list page
         return(RedirectToAction("CategoryList"));
     }
     ModelState.AddModelError("", "invalid entry");
     return(View(createCategoryViewModel));
 }