public ActionResult Index() { try { ApplicationDAO appdao = new ApplicationDAO(); UpdateNotesDAO updao = new UpdateNotesDAO(); CartDAO cdao = new CartDAO(); IList <Application> apps = appdao.ListLast10(); IList <Application> bapps = appdao.ListTop10(); IList <UpdateNotes> updates = updao.GetLast3(); IList <Application> appsinupdates = new List <Application>(); foreach (var u in updates) { if (u.Value.Length > 144) { u.Value = u.Value.Substring(0, 144); } appsinupdates.Add(appdao.SearchById(u.ApplicationId)); } if (Session["Id"] != null) { ViewBag.Cart = cdao.SearchCartUser(int.Parse(Session["Id"].ToString())); } ViewBag.Updates = updates; ViewBag.AppsinUpdates = appsinupdates; ViewBag.BApps = bapps; ViewBag.NApps = apps; return(View()); } 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")); } }