コード例 #1
0
        public IActionResult NewCollection(string collectionName, bool publicStatus)
        {
            int?userid = HttpContext.Session.GetInt32("userid");

            collectionDAL.CreateCollection(userid.Value, collectionName, publicStatus);
            return(RedirectToAction("Index", new { userId = userid.Value }));
        }
コード例 #2
0
        public IActionResult NewCollection(string collectionName, bool publicStatus)
        {
            var user = authProvider.GetCurrentUser();

            int?check = HttpContext.Session.GetInt32("userid");

            if (user != null && check.Value == user.Id)
            {
                int?userid = HttpContext.Session.GetInt32("userid");
                collectionDAL.CreateCollection(userid.Value, collectionName, publicStatus);
                return(RedirectToAction("Index", new { userId = userid.Value }));
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }