Example #1
0
        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")); }
        }
Example #2
0
 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"));
     }
 }
Example #3
0
 public ActionResult Product(int id)
 {
     try
     {
         ApplicationDAO dao   = new ApplicationDAO();
         DeveloperDAO   ddao  = new DeveloperDAO();
         ImageDAO       idao  = new ImageDAO();
         UserDAO        udao  = new UserDAO();
         SellItemDAO    sidao = new SellItemDAO();
         Application    app   = dao.SearchById(id);
         Developer      dev   = ddao.SearchById(app.DeveloperId);
         CartDAO        cdao  = new CartDAO();
         PegiDAO        pdao  = new PegiDAO();
         ViewBag.SellItem = false;
         if (Session["Id"] != null)
         {
             ViewBag.Cart     = cdao.SearchCartUser(int.Parse(Session["Id"].ToString()));
             ViewBag.SellItem = sidao.SearchUserApp(int.Parse(Session["Id"].ToString()), id);
             WishlistDAO wdao = new WishlistDAO();
             ViewBag.IsInWish = wdao.IsInWishList(int.Parse(Session["Id"].ToString()), id);
         }
         ViewBag.App     = app;
         ViewBag.Dev     = dev;
         ViewBag.Pegi    = pdao.SearchById(app.PegiId);
         ViewBag.DevUser = udao.SearchByDev(dev.Id);
         ViewBag.Img     = idao.SearchAppImages(id);
         ViewBag.Similar = dao.ListLast10();
         return(View());
     }
     catch
     {
         return(RedirectToAction("../Home/Index"));
     }
 }
Example #4
0
 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"));
     }
 }
Example #5
0
 // 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"));
     }
 }
Example #6
0
 public ActionResult Remove(int id)
 {
     try
     {
         if (Session["ModId"] != null)
         {
             PegiDAO dao = new PegiDAO();
             Pegi    p   = dao.SearchById(id);
             dao.Remove(p);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("../Home/Index"));
         }
     }
     catch
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Example #7
0
 public ActionResult Validate(Pegi pegi)
 {
     try
     {
         if (ModelState.IsValid)
         {
             PegiDAO dao = new PegiDAO();
             if (dao.IsUnique(pegi))
             {
                 dao.Add(pegi);
                 return(RedirectToAction("Index"));
             }
             return(RedirectToAction("Index"));
         }
         ViewBag.Pegi = pegi;
         return(View("Index"));
     }
     catch
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Example #8
0
 public ActionResult EditConfirm(Pegi pegi)
 {
     try
     {
         if (Session["ModId"] != null)
         {
             PegiDAO dao = new PegiDAO();
             Pegi    p   = dao.SearchById(pegi.Id);
             p.Age       = pegi.Age;
             p.Desc      = pegi.Desc;
             p.PhotoPath = pegi.PhotoPath;
             dao.Update();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("../Home/Index"));
         }
     }
     catch
     {
         return(RedirectToAction("Index", "Home"));
     }
 }