Example #1
0
        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));
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }
Example #6
0
        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));
        }
Example #8
0
        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));
        }
Example #9
0
        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));
        }
Example #10
0
        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));
        }
Example #11
0
        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));
        }
Example #12
0
        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));
        }
Example #13
0
        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));
        }
Example #14
0
        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));
        }
Example #16
0
        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));
        }
Example #17
0
        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));
        }
Example #18
0
        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));
        }
Example #19
0
        //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)));
        }
Example #20
0
        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
            };
        }
Example #21
0
        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));
        }
Example #22
0
        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));
        }
Example #23
0
        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));
        }
Example #24
0
        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));
        }
Example #25
0
        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));
        }
Example #26
0
        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));
        }
Example #27
0
        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);
        }
Example #28
0
        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));
        }
Example #29
0
        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));
        }
Example #30
0
        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));
        }