public ActionResult Details(int id) { var attendingMessage = ""; var gig = _unitOfWork.Gigs.GetGigWithArtists(id); if (gig == null) { return(HttpNotFound()); } var userId = User.Identity.GetUserId(); if (_unitOfWork.Attendences.GetAttendence(userId, gig.Id) != null) { attendingMessage = "You are going to this event"; } var isFollowing = (_unitOfWork.Followings.GetFollowing(userId, gig.ArtistId) != null); var viewModel = new GigDetailViewModel { Gig = gig, AttendingMessage = attendingMessage, IsFollowing = isFollowing }; return(View("Details", viewModel)); }
public ActionResult Details(int id) { // details of the Gig var gig = _unitOfWork.Gigs.GetGigDetails(id); if (gig == null) { return(HttpNotFound()); } var gigvm = new GigDetailViewModel { Gig = gig, }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); // get following/attending by userId gigvm.IsFollowing = gig.Artist.Followers.Any(f => f.FollowerId == userId); gigvm.IsAttending = gig.Attendances.Any(a => a.AttendeeId == userId); } return(View(gigvm)); }
public ActionResult Detail(Guid id) { if (Guid.Empty == id) { return(NotFound()); } var gig = _unitOfWork.Gig.GetGigWithArtist(id); if (gig == null) { NotFound(); } var model = new GigDetailViewModel() { Gig = gig }; var userId = _userManager.GetUserId(User); if (userId != null) { model.IsAttending = _unitOfWork.Attendance .GetAttendance(userId, gig.Id) != null; model.IsFollowingArtist = _unitOfWork.Following .GetFollowing(userId, gig.ArtistId) != null; model.IsAuthenticated = true; } return(View(model)); }
public ActionResult Detail(int id) { var gig = _context.Gigs .Include(g => g.Artist) .Include(g => g.Genre) .SingleOrDefault(g => g.Id == id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsAttending = _context.Attendances.Any(a => a.GigId == gig.Id && a.AttendeeId == userId); viewModel.IsFollowing = _context.Followings.Any(f => f.FolloweeId == gig.ArtistId && f.FollowerId == userId); } return(View("Detail", viewModel)); }
public ActionResult GigDetail(int?Id) { var userId = User.Identity.GetUserId(); Gig gigSelected = _unitOfWork.Gigs.GetGigWithAttendeesAndFollowees(Id); var gigDetailViewModel = new GigDetailViewModel { Artist = gigSelected.Artist, Date = gigSelected.DateTime.ToString("dd MMM"), Time = gigSelected.DateTime.ToString("hh:mm"), Venue = gigSelected.Venue, IsUserAttending = gigSelected.IsUserAttending(userId), IsUserFollowing = gigSelected.IsUserFollowing(userId), IsUserLoggedIn = !string.IsNullOrEmpty(userId) }; return(View(gigDetailViewModel)); }
public ActionResult Detail(int id) { var showActions = User.Identity.IsAuthenticated; var userId = User.Identity.GetUserId(); var gig = _unitOfWork.Gigs.GetGig(id); var following = _unitOfWork.Followings .GetFollowing(userId, gig.ArtistId) .Any(); var viewModel = new GigDetailViewModel { Gig = gig, ShowActions = showActions, Following = following }; return(View(viewModel)); }
public ActionResult Detail(int gigId) { var gig = _unitOfWork.Gigs.GetGigWithArtist(gigId); if (gig == null) { return(HttpNotFound()); } var userId = User.Identity.GetUserId(); bool userIsAttending = _unitOfWork.Attendances.GetAttendance(userId, gig.Id) != null; var viewModel = new GigDetailViewModel { Gig = gig, IsLoggedIn = User.Identity.IsAuthenticated, UserIsAttending = userIsAttending }; return(View(viewModel)); }
public ActionResult Details(GigDetailViewModel viewModel) { return(View(viewModel)); }