public ActionResult index(int page = 1) { var user = context.BikeUser.Where(u => u.userName == User.Identity.Name).First(); if (user.isArchived || user.lastRegistered.AddDays(context.settings.First().daysBetweenRegistrations) < DateTime.Now) { return RedirectToAction("Register"); } var model = new BikeShare.ViewModels.profileViewModel(); model.user = user; model.pagingInfo = new PageInfo(0, 25, 1); if (context.CheckOut.Where(c => c.rider == user.bikeUserId).Where(i => !i.isResolved).Count() > 0) { model.hasRental = true; model.hoursLeft = (int)context.CheckOut.Where(c => c.rider == user.bikeUserId).Where(i => !i.isResolved).First().timeOut.AddHours(24).Subtract(DateTime.Now).TotalHours; } return View(model); }
public ActionResult index(int page = 1) { var user = context.BikeUser.Where(u => u.userName == User.Identity.Name).First(); if (user.isArchived || user.lastRegistered.AddDays(context.settings.First().daysBetweenRegistrations) < DateTime.Now) { return(RedirectToAction("Register")); } var model = new BikeShare.ViewModels.profileViewModel(); model.user = user; model.pagingInfo = new PageInfo(0, 25, 1); if (context.CheckOut.Where(c => c.rider == user.bikeUserId).Where(i => !i.isResolved).Count() > 0) { model.hasRental = true; model.hoursLeft = (int)context.CheckOut.Where(c => c.rider == user.bikeUserId).Where(i => !i.isResolved).First().timeOut.AddHours(24).Subtract(DateTime.Now).TotalHours; } return(View(model)); }