Exemplo n.º 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")); }
        }
Exemplo n.º 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"));
     }
 }
Exemplo n.º 3
0
 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"));
     }
 }
Exemplo n.º 4
0
        public PartialViewResult TypesAppBar(int id)
        {
            TypeAppDAO dao = new TypeAppDAO();

            ViewBag.Id       = id;
            ViewBag.TypesBar = dao.List();
            return(PartialView());
        }
Exemplo n.º 5
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"));
     }
 }
Exemplo n.º 6
0
 public ActionResult Remove(int id)
 {
     try
     {
         if (Session["ModId"] != null)
         {
             TypeAppDAO dao = new TypeAppDAO();
             TypeApp    t   = dao.SearchById(id);
             dao.Remove(t);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("../Home/Index"));
         }
     }
     catch
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemplo n.º 7
0
 public ActionResult Validate(TypeApp typeapp)
 {
     try
     {
         if (ModelState.IsValid)
         {
             TypeAppDAO dao = new TypeAppDAO();
             if (dao.IsUnique(typeapp))
             {
                 dao.Add(typeapp);
                 return(RedirectToAction("Index"));
             }
             return(RedirectToAction("Index"));
         }
         ViewBag.Lang = typeapp;
         return(View("Register"));
     }
     catch
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemplo n.º 8
0
 public ActionResult EditConfirm(TypeApp TypeApp)
 {
     try
     {
         if (Session["ModId"] != null)
         {
             TypeAppDAO dao = new TypeAppDAO();
             TypeApp    t   = dao.SearchById(TypeApp.Id);
             t.Name = TypeApp.Name;
             dao.Update();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("../Home/Index"));
         }
     }
     catch
     {
         return(RedirectToAction("Index", "Home"));
     }
 }