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 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")); } }
public ActionResult Remove(int id) { try { ApplicationDAO dao = new ApplicationDAO(); ImageDAO idao = new ImageDAO(); Application a = dao.SearchById(id); if (Session["ModId"] != null || int.Parse(Session["DevId"].ToString()) == a.DeveloperId) { try { IList <Image> imgs = idao.SearchAppImages(a.Id); foreach (var i in imgs) { string p = i.Url; p = p.Replace("../../..", "../.."); string fullPath = Request.MapPath(p); idao.Remove(i); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } } } catch { } try { string pa = a.Archive; pa = pa.Replace("../../..", "../.."); string fullPathArch = Request.MapPath(pa); if (System.IO.File.Exists(fullPathArch)) { System.IO.File.Delete(fullPathArch); } } catch { } dao.Remove(a); return(RedirectToAction("Summary", "Developer")); } return(RedirectToAction("Index", "Home")); } 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")); } }