public ActionResult ProfileView() { try { if (Session["ModId"] != null) { UserDAO udao = new UserDAO(); ModeratorDAO dao = new ModeratorDAO(); SellDAO sdao = new SellDAO(); ApplicationDAO adao = new ApplicationDAO(); ViewBag.Mod = dao.SearchById(int.Parse(Session["ModId"].ToString())); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.NewUser = udao.GetMonthUsers().Count; ViewBag.NewGame = adao.GetGamesMonth().Count; ViewBag.NewSoft = adao.GetSoftwareMonth().Count; ViewBag.NewMob = adao.GetMobileMonth().Count; ViewBag.SaleCount = sdao.Get7DaysSells(); ViewBag.User = u; return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Index() { try { if (Session["ModId"] != null) { TypeAppDAO dao = new TypeAppDAO(); UserDAO udao = new UserDAO(); ModeratorDAO mdao = new ModeratorDAO(); ViewBag.Mod = mdao.SearchById(int.Parse(Session["ModId"].ToString())); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.User = u; ViewBag.Type = new TypeApp(); ViewBag.Types = dao.List(); return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
public PartialViewResult GenreIndex() { if (Session["ModId"] != null) { GenreDAO dao = new GenreDAO(); UserDAO udao = new UserDAO(); ModeratorDAO mdao = new ModeratorDAO(); ViewBag.Mod = mdao.SearchById(int.Parse(Session["ModId"].ToString())); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.User = u; ViewBag.Genre = new Genre(); ViewBag.Genres = dao.List(); return(PartialView()); } else { return(PartialView()); } }
public ActionResult Login(User user) { try { UserDAO dao = new UserDAO(); User u = dao.Login(user); var result = ""; if (u != null) { Session["Id"] = u.Id; Session["Username"] = u.Username; if (u.DeveloperId != null) { DeveloperDAO ddao = new DeveloperDAO(); Developer d = ddao.SearchById(int.Parse(u.DeveloperId.ToString())); Session["DevId"] = d.Id; } if (u.ModeratorId != null) { ModeratorDAO mdao = new ModeratorDAO(); Moderator m = mdao.SearchById(int.Parse(u.ModeratorId.ToString())); Session["ModId"] = m.Id; } result = "Logged In"; return(Json(result, JsonRequestBehavior.AllowGet)); //return RedirectToAction("../Home/Index"); } result = "An error occurred. Try again"; return(Json(result, JsonRequestBehavior.AllowGet)); //return RedirectToAction("../Home/Index"); } catch { return(RedirectToAction("Index", "Home")); } }