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 { 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")); } }
public ActionResult Edit(int id) { 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 = dao.SearchById(id); return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
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")); } }