public ActionResult ApproveApp(int id) { try { if (Session["ModId"] != null) { UserDAO udao = new UserDAO(); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ImageDAO idao = new ImageDAO(); ApplicationDAO dao = new ApplicationDAO(); TypeAppDAO tdao = new TypeAppDAO(); GenreDAO gdao = new GenreDAO(); PegiDAO pdao = new PegiDAO(); ApplicationGenreDAO agdao = new ApplicationGenreDAO(); ViewBag.Types = tdao.List(); ViewBag.Pegis = pdao.List(); ViewBag.AppGens = agdao.ListByApplication(id); ViewBag.Genres = gdao.List(); ViewBag.User = u; ViewBag.App = dao.SearchById(id); ViewBag.Img = idao.SearchAppImages(id); return(View()); } return(RedirectToAction("Index", "Home")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Register() { try { if (Session["DevId"] != null) { TypeAppDAO tdao = new TypeAppDAO(); PegiDAO pdao = new PegiDAO(); UserDAO udao = new UserDAO(); GenreDAO gdao = new GenreDAO(); ViewBag.Class = ""; ViewBag.Type = tdao.List(); ViewBag.Pegi = pdao.List(); ViewBag.App = new Application(); ViewBag.Genres = gdao.ListId(); ViewBag.User = udao.SearchById(int.Parse(Session["Id"].ToString())); return(View()); } return(RedirectToAction("../Home/Index")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult EditApp(int id) { try { ApplicationDAO dao = new ApplicationDAO(); Application App = dao.SearchById(id); UserDAO udao = new UserDAO(); TypeAppDAO tdao = new TypeAppDAO(); PegiDAO pdao = new PegiDAO(); GenreDAO gdao = new GenreDAO(); ApplicationGenreDAO agdao = new ApplicationGenreDAO(); if (Session["ModId"] != null || App.DeveloperId == int.Parse(Session["DevId"].ToString())) { ViewBag.User = udao.SearchById(int.Parse(Session["Id"].ToString())); ImageDAO idao = new ImageDAO(); ViewBag.Imgs = idao.SearchAppImages(App.Id); ViewBag.App = App; ViewBag.Types = tdao.List(); ViewBag.Pegis = pdao.List(); IList <Genre> genres = gdao.ListId(); IList <ApplicationGenre> agens = agdao.ListByApplication(id); foreach (var ag in agens) { foreach (var g in genres) { if (ag.GenreId == g.Id) { g.IsChecked = true; } } } ViewBag.Genres = genres; return(View()); } return(RedirectToAction("Index", "Home")); } catch { return(RedirectToAction("Index", "Home")); } }
// GET: Pegi public ActionResult Index() { try { if (Session["ModId"] != null) { PegiDAO dao = new PegiDAO(); UserDAO udao = new UserDAO(); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.User = u; ViewBag.Pegi = new Pegi(); ViewBag.Pegis = dao.List(); return(View()); } return(RedirectToAction("../Home/Index")); } catch { return(RedirectToAction("Index", "Home")); } }