public ActionResult Details(int id) { var gig = _unitOfWork.GigsRepository.GetGig(id); if (gig == null) { return(HttpNotFound()); } var model = new GigDetailsViewModel { Gig = Mapper.Map <Gig, GigDto>(gig) }; if (!User.Identity.IsAuthenticated) { return(View(model)); } var user = _unitOfWork.UserRepository.GetUserIncludeGigsAndFollowees(User.Identity.GetUserId()); model.IsFollowing = user.IsFollowing(gig.Artist.Id); model.IsAttending = user.IsAttending(gig.Id); return(View(model)); }
public ActionResult Details(int id) { var gig = _unitOfWork.Gigs.GetGig(id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsAttending = _unitOfWork.Attendances.GetAttendance(gig.Id, userId) != null; //ο controller είναι υπεύθυνος για το αν παρακολουθεί ή όχι την συναυλία. Το repository φέρνει μόνο το attendance. viewModel.IsFollowing = _unitOfWork.Followings.GetFollowing(gig.ArtistId, userId) != null; } return(View("Details", viewModel)); }
public ActionResult Details(int id) { var context = new ApplicationDbContext(); var gigs = context.Gigs .Include(m => m.Artist) .Include(m => m.Genre) .SingleOrDefault(m => m.Id == id); if (gigs == null) { return(HttpNotFound()); } var gigDetails = new GigDetailsViewModel() { Gig = gigs }; if (User.Identity.IsAuthenticated) { var user = User.Identity.GetUserId(); gigDetails.IsAttending = context.Attendences.Any(m => m.AttendeeId == user && m.GigId == gigs.Id); gigDetails.IsFollowing = context.Followings.Any(m => m.FollowerId == user && m.FolloweeId == gigs.ArtistId); } return(View("Details", gigDetails)); }
public ActionResult Details(int id) { if (id < 1) { return(HttpNotFound("Incorrect gig id has been delivered")); } var gig = _unitOfWork.Gigs.GetGigWithArtistGenreById(id); if (gig == null) { return(HttpNotFound()); } var gigViewModel = new GigDetailsViewModel() { ShowActions = User.Identity.IsAuthenticated, Heading = "Details", Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); gigViewModel.IsFollowing = _unitOfWork.Following.FollowingArtistByUser(gig.ArtistId, userId); gigViewModel.IsGoing = _unitOfWork.Attendance.AttendigGigByUser(id, userId); } return(View("Details", gigViewModel)); }
public ActionResult Details(int id) { var gig = _unitOfWork.Gigs.GetGigWithDetails(id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.AttendeeStatus = _unitOfWork .Attendance .GetAttendancesByUserId(userId, gig.Id) != null; viewModel.isFolowing = _unitOfWork.Following.GetFollowing(gig.ArtistId, userId) != null; } return(View("GigDetails", viewModel)); }
public ActionResult Details(int Id) { var gig = _UnitOfWork.Gigs.GetGigWithArtistAndGenre(Id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsGoing = _UnitOfWork.Attendances.GetIfAnyAttendance(gig.Id, userId) != null; viewModel.IsFollowing = _UnitOfWork.Followings.GetAnyFollowings(gig.ArtistId, userId) != null; } return(View("Details", viewModel)); }
public ActionResult Details(int id) { var gig = GetTheGig(id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsAttending = _context.Attendances .Any(a => a.AttendeeId == userId && a.GigId == gig.Id); viewModel.IsFollowing = _context.Followings .Any(f => f.FollowerId == gig.ArtistId && f.FolloweeId == userId); } ; return(View(viewModel)); }
public ActionResult Details(int gigId) { var gig = _unitOfWork.Gigs.GetDetailsGigById(gigId); if (gig == null) { return(HttpNotFound("NotFound")); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (!User.Identity.IsAuthenticated) { return(View(viewModel)); } var userId = User.Identity.GetUserId(); viewModel.IsGoing = _unitOfWork.Gigs.AttendanceGoingThisGig(gigId, userId); viewModel.IsFollowing = _unitOfWork.Followings.UserFollowingThisArtist(gig, userId); return(View(viewModel)); }
public ActionResult Details(int id) { var gig = _unitOfWork.Gigs.GetGig(id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel() { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsGoing = _unitOfWork.Attendances.IsAttending(id, userId); viewModel.IsFollowing = _unitOfWork.Followings.IsFollowing(gig.ArtistId, userId); } return(View(viewModel)); }
public ActionResult GetGigDetails(int Id) { var currentlyloggedUserId = User.Identity.GetUserId(); var gig = dbContext.Gigs.Include(a => a.Genere).Include(a => a.Artist).SingleOrDefault(a => a.Id == Id); var artistId = gig.ArtistId; if (gig == null) { return(HttpNotFound()); } //get relation between currently logged user and artist bool isFollowing = dbContext.Following.Any(a => a.FollowerId == currentlyloggedUserId && a.FolloweeId == artistId); bool isAttending = dbContext.Attendences.Any(a => a.GigId == gig.Id && a.AttenderId == currentlyloggedUserId); if (isFollowing) { ViewBag.Following = true; } else { ViewBag.Following = false; } GigDetailsViewModel gigDetailsViewModel = new GigDetailsViewModel() { Gig = gig, IsFollowing = isFollowing, IsAttending = isAttending }; return(View(gigDetailsViewModel)); }
public ActionResult Details(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 GigDetailsViewModel() { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsAttending = _attendanceRepository.GetAttendances(gig.Id, userId) != null; viewModel.IsFollowing = _followingRepository.GetFollowing(gig.ArtistId, userId) != null; } return(View("Details", viewModel)); }
public ActionResult Details(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 GigDetailsViewModel { 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("Details", viewModel)); }
public ActionResult Details(int id) { var gig = _unitOfWork.Gigs.GetGig(id); if (gig is null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { ArtistName = gig.Artist.Name, ArtistId = gig.ArtistId, Venue = gig.Venue, DateTime = gig.DateTime, Genre = gig.Genre.Name }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.Following = _unitOfWork.Followers.IsFollowing(gig.ArtistId, userId); viewModel.Attending = _unitOfWork.Attendances.IsAttending(gig.Id, userId); } return(View("GigDetails", viewModel)); }
public ActionResult GigDetails(int id) { var gig = _unitOfWork.Gigs.GetGigWithArtistAndGenre(id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var currentUser = User.Identity.GetUserId(); // Find out if the user is going. viewModel.IsAttending = _unitOfWork.Attendances.GetAttendance(gig.Id, currentUser) != null; // Find out if the user is following the artist. viewModel.IsFollowing = _unitOfWork.Followings.GetFollowing(currentUser, gig.ArtistId) != null; } return(View("GigDetails", viewModel)); }
public async Task <IActionResult> Details(string id) { var gig = _unitOfWork.Gigs.GetGig(id); if (gig == null) { return(RedirectToAction("Index", "Home")); } var viewModel = new GigDetailsViewModel() { Gig = gig }; if (_signInManager.IsSignedIn(HttpContext.User)) { var currentUser = await _userManager.GetUserAsync(HttpContext.User); viewModel.IsAttending = _unitOfWork.Attendances.GetAttendance(gig.Id, currentUser.Id) != null; viewModel.IsFollowing = _unitOfWork.Followings.GetFollowing(currentUser.Id, gig.Artist.Id) != null; } return(View("Details", viewModel)); }
public ActionResult Details(int id) { Gig gig = unitOfWork.Gigs.GetGig(id); if (gig == null) { return(HttpNotFound()); } GigDetailsViewModel viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { string userId = User.Identity.GetUserId(); viewModel.IsAttending = unitOfWork.Attendances.GetAttendance(gig.Id, userId) != null; viewModel.IsFollowing = unitOfWork.Follows.GetFollowing(gig.ArtistId, userId) != null; } return(View(viewModel)); }
public ActionResult Details(int id) { var gig = _unitOfWork.GigRepository.GetGigById(id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Vanue = gig.Vanue, DateTime = gig.DateTime, ArtistName = gig.Artist.Name }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsLoggedIn = User.Identity.IsAuthenticated; viewModel.IsFollowing = _unitOfWork.FollowingRepository.GetFollowing(userId, gig.ArtistId) != null; viewModel.IsGoing = _unitOfWork.AttendaceRepository.GetAttendance(userId, gig.Id) != null; } return(View(viewModel)); }
public ActionResult Details(int id) { var userId = User.Identity.GetUserId(); var gig = _unitOfWork.Gigs.GetGigsUserAttending(userId) .SingleOrDefault(g => g.Id == id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { viewModel.IsAttending = _unitOfWork.Attendances.GetAttendance(gig.Id, userId) != null; viewModel.IsFollowing = _unitOfWork.Follows.GetFollowing(userId, gig.ArtistId) != null; } return(View("Details", viewModel)); }
//Gets gig's details public ActionResult Details(int gigId) { var gig = _unitOfWork.Gigs.GetGigWithAttendeesAndArtistFollowers(gigId); if (gig == null) { return(HttpNotFound()); } return(View(GigDetailsViewModel.Create(gig, User.Identity.GetUserId(), User.Identity.IsAuthenticated))); }
public ActionResult Details(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 GigDetailsViewModel { Gig = gig }; }
public ActionResult Details(int gigId) { string userId = User.Identity.GetUserId(); var gig = /*_gigRepository*/ _unitOfWork.Gigs.GetGig(gigId); GigDetailsViewModel model = new GigDetailsViewModel() { Gig = gig, IsAttending = /*_attendaceRepository*/ _unitOfWork.Attendaces.GetAttendance(gigId, userId) != null, /*_context.Attendances. * Any(a => a.AttendeeId == userId && a.GigId == gigId),*/ IsFollowing = /*_followingRepository*/ _unitOfWork.Followings.GetFollowing(userId, gig.ArtistId) != null /*_context.Followings. * Any(f => f.FollowerId == userId && f.FolloweeId == gig.Artist.Id)*/ }; return(View(model)); }
public ActionResult Detail(int gigId) { var userId = User.Identity.GetUserId(); var gig = _context.Gigs.Include(g => g.Artist).SingleOrDefault(g => g.Id == gigId); var ViewModel = new GigDetailsViewModel { Gig = gig }; ViewModel.IsFollowing = _context.Followings.Any(f => f.FollowerId == userId && f.FolloweeId == gig.ArtistId); ViewModel.IsAttending = _context.Attendances.Any(a => a.AttendeeId == userId && a.GigId == gig.Id); return(View(ViewModel)); }
public ViewResult GigView(int id) { var userId = User.Identity.GetUserId(); var gig = _unitofWork.Gigs.Get(id); var viewmodel = new GigDetailsViewModel { Artist = gig.Artist, Datetime = gig.Datetime, Genre = gig.Genre, Venue = gig.Venue, IsAttending = _unitofWork.Attendences.GetAttendance(id, userId) != null, IsFollowing = _unitofWork.Followings.GetFollower(gig.ArtistId, userId) != null, IsUserAuthorized = User.Identity.IsAuthenticated }; return(View("GigView", viewmodel)); }
public IActionResult Details(int id) { var gig = _unitOfWork.Gigs.GetGigWithArtistWithFollowersAndAttendances(id); if (gig == null) { return(NotFound()); } var viewModel = new GigDetailsViewModel(gig); if (User.Identity.IsAuthenticated) { viewModel.GetUserInfo(_userManager.GetUserId(User)); } return(View(viewModel)); }
public ActionResult Details(int id) { var gig = _unitOfWork.GigRepository.GetGigWithArtistAndGenre(id); if (gig == null) { return(HttpNotFound()); } var userId = User.Identity.GetUserId(); var details = new GigDetailsViewModel() { Gig = gig, IsAttending = _unitOfWork.AttendanceRepository.GetAttendance(id, userId), IsFollowing = _unitOfWork.FollowingRepository.GetFollowing(gig.ArtistId, userId) }; return(View(details)); }
public ActionResult Details(int id) { var userId = User.Identity.GetUserId(); var gig = _context.Gigs.Include(x => x.Artist) .Include(x => x.Genre) .FirstOrDefault(x => x.Id == id); var isAttending = _context.Attendences.Any(x => x.GigId == gig.Id && x.AttendeeId == userId); var isFollowing = _context.Followings.Any(x => x.FollowerId == userId && x.FolloweeId == gig.ArtistId); GigDetailsViewModel model = new GigDetailsViewModel { Gig = gig, IsAttending = isAttending, IsFollowing = isFollowing }; return(View(model)); }
public ActionResult Details(int id) { var gig = _unitOfWork.Gigs.GetGig(id); if (gig == null) return HttpNotFound(); var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsAttending = _unitOfWork.Attendances.CheckAttendance(gig.Id, userId); viewModel.IsFollowing = _unitOfWork.Followings.CheckFollowing(gig.ArtistId, userId); } return View("Details", viewModel); }
public ActionResult Details(int id) { var userId = User.Identity.GetUserId(); var gig = _unitOfWork.Gigs.GetGigById(id); if (gig == null) { return(HttpNotFound()); } var GigDetailsVM = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { GigDetailsVM.IsAttending = _unitOfWork.Attendances.GetAttendance(gig.Id, userId) != null; GigDetailsVM.IsFollowing = _unitOfWork.Followings.GetFollowing(userId, gig.ArtistId) != null; } return(View("Details", GigDetailsVM)); }
public ActionResult Details(int id) { var gig = _gigRepository.GetSingleGig(id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.isAttending = _attendanceRepository.GetAttendance(userId, gig.Id) != null; viewModel.isFollowing = _attendanceRepository.GetFollowing(userId, gig.ArtistId) != null; } return(View(viewModel)); }
public ActionResult Details(int id) { var gig = _context.Gigs.Include("Artist") .FirstOrDefault(g => g.Id == id); var model = new GigDetailsViewModel { Gig = gig }; if (gig == null) { return(this.HttpNotFound()); } if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); model.IsAttending = this._unitOfWork.Attendances.GetAttendance(id, userId) != null; model.IsFollowing = this._unitOfWork.Followings.GetFollowing(userId, gig.ArtistId) != null; } return(this.View("Details", model)); }