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 })); }
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")); } }