public PartialViewResult HomeList_byLatest2(string Page) { AgfMembershipProvider membership = new AgfMembershipProvider(); MovieAccess movieAccess = new MovieAccess(); bool check; if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var user = User.Identity.Name.ToString(); Guid?userId = membership.GetUserIdByEmail(user); var res = movieAccess.GetHomeList(userId).OrderBy(s => s.DateAdded); var count = Math.Ceiling(res.Count() / 6.0); ViewBag.Pages = count; int page = int.Parse(Page == null ? "1" : Page); ViewBag.Page = page; res = res.Skip((page - 1) * 6).ToList().Take(6).OrderBy(s => s.DateAdded); return(PartialView("_GetCardss", res)); } else { var res = movieAccess.GetHomeList().OrderBy(s => s.DateAdded); return(PartialView("_GetCardss", res)); } }
public ActionResult HomeList_byMood(List <int> moods) { AgfMembershipProvider membership = new AgfMembershipProvider(); MovieAccess movieAccess = new MovieAccess(); bool check; if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var user = User.Identity.Name.ToString(); Guid?userId = membership.GetUserIdByEmail(user); var res = movieAccess.GetHomeListForUserSelectedMoods(moods, userId); return(PartialView("_GetCardss", res)); } else { var res = movieAccess.GetHomeListForUserSelectedMoods(moods); return(PartialView("_GetCardss", res)); } }
// GET: Users/AGF100 public ActionResult AGF100() { AgfMembershipProvider membership = new AgfMembershipProvider(); MovieAccess movieAccess = new MovieAccess(); bool check; if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var user = User.Identity.Name.ToString(); Guid?userId = membership.GetUserIdByEmail(user); var res = movieAccess.GetHomeList(userId).OrderByDescending(s => s.GreatnessRating); return(View(res)); } else { var res = movieAccess.GetHomeList().OrderByDescending(s => s.GreatnessRating); return(View(res)); } }
public PartialViewResult _RandomMovie() { AgfMembershipProvider membership = new AgfMembershipProvider(); MovieAccess movieAccess = new MovieAccess(); bool check; if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var user = User.Identity.Name.ToString(); Guid?userId = membership.GetUserIdByEmail(user); var res = movieAccess.GetRandom(userId).OrderBy(r => Guid.NewGuid()).Take(1); return(PartialView("_RandomMovie", res)); } else { var res = movieAccess.GetRandom().OrderBy(r => Guid.NewGuid()).Take(1); return(PartialView("_RandomMovie", res)); } }
public PartialViewResult _fav() { AgfMembershipProvider membership = new AgfMembershipProvider(); MovieAccess movieAccess = new MovieAccess(); bool check; if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var user = User.Identity.Name.ToString(); Guid?userId = membership.GetUserIdByEmail(user); var res = movieAccess.GetUserFavMovies(userId).OrderByDescending(s => s.DateAdded); ViewBag.ListTitle = "Favorite"; var Tcount = res.Count(); ViewBag.Fcount = Tcount; return(PartialView("_UserListContainer", res)); } else { var res = movieAccess.GetHomeList().OrderByDescending(s => s.DateAdded); return(PartialView("_UserListContainer", res)); } }
// GET: Users/UserProfile public ActionResult UserProfile() { AgfMembershipProvider membership = new AgfMembershipProvider(); MovieAccess movieAccess = new MovieAccess(); bool check; if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var user = User.Identity.Name.ToString(); Guid?userId = membership.GetUserIdByEmail(user); var res = movieAccess.GetUserToWatchMovies(userId).OrderByDescending(s => s.DateAdded); var resWatched = movieAccess.GetUserWatchedMovies(userId).OrderByDescending(s => s.DateAdded); var resFav = movieAccess.GetUserFavMovies(userId).OrderByDescending(s => s.DateAdded); var Tcount = res.Count(); var Wcount = resWatched.Count(); var Fcount = resFav.Count(); ViewBag.count = Tcount; ViewBag.Wcount = Wcount; ViewBag.Fcount = Fcount; ViewBag.ListTitle = "To-Watch"; return(View(res)); } else { var res = movieAccess.GetHomeList().OrderByDescending(s => s.DateAdded); return(View(res)); } }
public ActionResult Actions(int movie_id, string UserAction) { UserAccess ua = new UserAccess(); AgfMembershipProvider membership = new AgfMembershipProvider(); try { if (ModelState.IsValid) { bool check; if (check = System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var user = User.Identity.Name.ToString(); Guid?userId = membership.GetUserIdByEmail(user); switch (UserAction) { case "w": { if (ua.User_AddtoWatched(movie_id, userId) == false) { return(Json(new { success = false, responseText = "Cannot add to Watched." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = true, responseText = "Cannot add to Watched." }, JsonRequestBehavior.AllowGet)); } } case "f": { if (ua.User_AddToFav(movie_id, userId) == false) { return(Json(new { success = false, responseText = "Cannot add to Watched." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = true, responseText = "Cannot add to Watched." }, JsonRequestBehavior.AllowGet)); } } case "t": { if (ua.AddToWatchlist(movie_id, userId) == false) { return(Json(new { success = false, responseText = "Cannot add to Watched." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = true, responseText = "Cannot add to Watched." }, JsonRequestBehavior.AllowGet)); } } } } else { ViewBag.failureMessage = "<p>FAILED. Please Login.</p>"; return(View()); } } } catch (Exception e1) { TempData["Msg"] = "Failed" + e1.Message; } return(View()); }