public ActionResult Sales() { try { if (Session["ModId"] != null) { SellDAO dao = new SellDAO(); IList <Sell> s = dao.List(); ViewBag.Sells = dao.List(); ViewBag.Graph1 = dao.Get7DaysSells(); ViewBag.Graph2 = dao.GetMonthlySells(); ViewBag.SaleCount = dao.Get7DaysSells(); UserDAO udao = new UserDAO(); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.User = u; return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("../Home/Index")); } }
public ActionResult ProfileView() { try { if (Session["ModId"] != null) { UserDAO udao = new UserDAO(); ModeratorDAO dao = new ModeratorDAO(); SellDAO sdao = new SellDAO(); ApplicationDAO adao = new ApplicationDAO(); ViewBag.Mod = dao.SearchById(int.Parse(Session["ModId"].ToString())); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.NewUser = udao.GetMonthUsers().Count; ViewBag.NewGame = adao.GetGamesMonth().Count; ViewBag.NewSoft = adao.GetSoftwareMonth().Count; ViewBag.NewMob = adao.GetMobileMonth().Count; ViewBag.SaleCount = sdao.Get7DaysSells(); ViewBag.User = u; return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Sell() { try { CartDAO cdao = new CartDAO(); IList <Cart> cart = cdao.GetUserCart(int.Parse(Session["Id"].ToString())); if (Session["Id"] != null && cart.Count() != 0) { SellDAO dao = new SellDAO(); Sell s = new Sell(); s.UserId = int.Parse(Session["Id"].ToString()); s.Date = DateTime.Now; s.TotalPrice = cdao.GetSubtotal(s.UserId); dao.Add(s); foreach (var c in cart) { SellItemDAO sidao = new SellItemDAO(); SellItem si = new SellItem(); si.ApplicationId = c.ApplicationId; si.PriceItem = c.Price; si.SellId = s.Id; sidao.Add(si); cdao.Remove(c); //Removing from Wishlist WishlistDAO wdao = new WishlistDAO(); IList <Wishlist> wishs = wdao.GetUserList(int.Parse(Session["Id"].ToString())); foreach (var w in wishs) { if (w.ApplicationId == c.ApplicationId) { wdao.Remove(w); } } } return(RedirectToAction("Library", "User")); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("../Home/Index")); } }
public ActionResult Sales() { try { if (Session["DevId"] != null) { DeveloperDAO dao = new DeveloperDAO(); UserDAO udao = new UserDAO(); SellDAO sdao = new SellDAO(); Developer d = dao.SearchById(int.Parse(Session["DevId"].ToString())); ViewBag.User = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.Dev = d; ViewBag.SaleCount = sdao.DevGet7DaysSells(int.Parse(Session["DevId"].ToString())); return(View()); } return(RedirectToAction("Index", "Home")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Library() { try { if (Session["Id"] != null) { CartDAO cardao = new CartDAO(); SellItemDAO sidao = new SellItemDAO(); SellDAO sdao = new SellDAO(); ApplicationDAO appdao = new ApplicationDAO(); IList <SellItem> si = sidao.GetUserApps(int.Parse(Session["Id"].ToString())); ViewBag.UserApps = si; ViewBag.AppsinLib = appdao.GetAppsInLibrary(si); ViewBag.Sells = sdao.GetUserSells(int.Parse(Session["Id"].ToString())); ViewBag.Cart = cardao.SearchCartUser(int.Parse(Session["Id"].ToString())); return(View()); } return(RedirectToAction("../Home/Index")); } catch { return(RedirectToAction("Index", "Home")); } }