here i have my LogIn Controller where if the log in is successful then a modal should pop up which will prompt the user to select mood:
[HttpPost]
public ActionResult LogIn(User u)
{
var user = _userRepo.Table.Where(model => model.Username == u.Username && model.Password == u.Password).FirstOrDefault();
try
{
if (_userRepo.Table.Where(model => model.Username == u.Username).FirstOrDefault().Password != u.Password)
{
ModelState.AddModelError("", "Invalid password");
ViewBag.LoginSuccess = false;
return View();
}
}
catch (NullReferenceException)
{
ModelState.AddModelError("", "User not exist");
ViewBag.LoginSuccess = false;
return View();
}
catch (TargetException)
{
ModelState.AddModelError("", "User not exist");
ViewBag.LoginSuccess = false;
return View();
}
FormsAuthentication.SetAuthCookie(u.Username, false);
ViewBag.LoginSuccess = true;
Session["User"] = user;
//return RedirectToAction("Register");
return RedirectToAction("../UsersPage/ChooseMood");
again if log in was succssful, a modal should pop up instanly which will prompt user to select mood before proceeding to this controller:
public ActionResult UsersHome(string mood)
{
if (User.Identity.IsAuthenticated)
{
return PartialView((User)Session["User"]);
} else
{
return View("../Home/Index");
}
}
what should be my approach? should I create new controller for the choose mood(modal pop up) then redirect to that UserHome controller?