Exemplo n.º 1
0
 public void Dispose()
 {
     Gigs.Dispose();
     Attendances.Dispose();
     Followings.Dispose();
     Genres.Dispose();
     UserNotifications.Dispose();
     Users.Dispose();
     Roles.Dispose();
     //  UserDescriptions.Dispose();
 }
Exemplo n.º 2
0
        public void Cancel_UserCancelingAnotherUsersGis_ShouldRreturnUnAuterized()
        {
            var gig = new Gigs {
                ArtistId = _userid + "-"
            };

            _mockRepository.Setup(r => r.GetGigWithAttendees(1)).Returns(gig);
            var result = _gigsController.Cancel(1);

            result.Should().BeOfType <UnauthorizedResult>();
        }
Exemplo n.º 3
0
        public void Cancel_GigUsCancel_ShouldReturnNotFound()
        {
            var gig = new Gigs();

            gig.Cancel();

            _mockRepository.Setup(r => r.GetGigWithAttendees(1)).Returns(gig);
            var result = _gigsController.Cancel(1);

            result.Should().BeOfType <NotFoundResult>();
        }
Exemplo n.º 4
0
        public void Cancel_ValidRequest_ShouldReturnOkay()
        {
            var gig = new Gigs()
            {
                ArtistId = _userid
            };

            _mockRepository.Setup(r => r.GetGigWithAttendees(1)).Returns(gig);
            var result = _gigsController.Cancel(1);

            result.Should().BeOfType <OkResult>();
        }
Exemplo n.º 5
0
        public void GetUpComingGigsByArtist_GigIsInThePast_ShouldNotBeReturn()
        {
            var gig = new Gigs {
                DateTime = DateTime.Now.AddDays(-1), ArtistId = "1"
            };

            _mockGigs.SetSource(new[] { gig });

            var gigs = _gigRespository.GetUpComingGigsByArtist("1");

            gigs.Should().BeEmpty();
        }
Exemplo n.º 6
0
        public void GetUpcomingGigsByArtist_GigIsforTheGivenArtistAndIsInTheFuture_ShouldReturnOk()
        {
            var gig = new Gigs {
                DateTime = DateTime.Now.AddDays(1), ArtistId = "1"
            };



            _mockGigs.SetSource(new[] { gig });
            var gigs = _gigRespository.GetUpComingGigsByArtist(gig.ArtistId);

            gigs.Should().Contain(gig);
        }
Exemplo n.º 7
0
        public void GetUpcomoingByArtist_GigISforDiffrentArtist_ShouldNotBeReturn()
        {
            var gig = new Gigs {
                DateTime = DateTime.Now.AddDays(1), ArtistId = "1"
            };



            _mockGigs.SetSource(new[] { gig });
            var gigs = _gigRespository.GetUpComingGigsByArtist(gig.ArtistId + "_");

            gigs.Should().BeEmpty();
        }
Exemplo n.º 8
0
        public void GetNewNotificationFor_IsRead_ShouldReturnEmpty()
        {
            var gig = new Gigs {
                DateTime = DateTime.Now.AddDays(1), ArtistId = "1"
            };
            var noti = new Notification(gig, NotificationType.GigCreate);

            _mockNotification.SetSource(new List <Notification>()
            {
                noti
            });

            var notication = _notificationRepository.GetNotifications("1");
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            // load city text file
            Cities = SitesLoader.LoadCities();

            // scrape cities for gigs
            foreach (var site in Cities)
            {
                Console.WriteLine($"[*] crawling {site}");
                Gig gcg = new Gig(site);
                Console.WriteLine($"[*] crawled {gcg.Site} @ {gcg.Gigs.Count} gigs");
                Gigs.Add(gcg);
                GigCount += gcg.Gigs.Count;
                Console.WriteLine($"[*] {Gigs.Count} cities crawled @ {GigCount} gigs");
                Thread.Sleep(1000);
            }
            CreateHTML();
        }
Exemplo n.º 10
0
        public ActionResult Create(GigFormViewModel ViewModel)
        {
            if (!ModelState.IsValid)
            {
                ViewModel.Genres = _unitOfWork.Genre.GetGenre();
                return(View("GigForm", ViewModel));
            }
            var gig = new Gigs
            {
                ArtistId = User.Identity.GetUserId(),
                GenreId  = ViewModel.Genre,
                Venue    = ViewModel.Venue,
                DateTime = ViewModel.GetDateTime()
            };

            _unitOfWork.Gigs.Add(gig);

            _unitOfWork.Complate();

            return(RedirectToAction("Mine", "Gigs"));
        }
Exemplo n.º 11
0
        private bool IsArtistAUser(Gigs gigs, out ActionResult actionResult)
        {
            if (gigs == null)
            {
                {
                    actionResult = HttpNotFound();
                    return(true);
                }
            }


            if (gigs.ArtistId != User.Identity.GetUserId())
            {
                {
                    actionResult = new HttpUnauthorizedResult();
                    return(true);
                }
            }
            actionResult = null;
            return(false);
        }
Exemplo n.º 12
0
        public ActionResult Create(GigsFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                //Genres need to populate first
                viewModel.Genres = _context.Genre.ToList();
                return(View("GigForm", "Gigs"));
            }


            var gigs = new Gigs
            {
                ArtistId = User.Identity.GetUserId(),
                DateTime = viewModel.GetDateTime(),
                GenreId  = viewModel.Genre,
                Venue    = viewModel.Venue
            };

            _context.Gigs.Add(gigs);
            _context.SaveChanges();
            return(RedirectToAction("Mine", "Home"));
        }
Exemplo n.º 13
0
 public void Add(Gigs gigs)
 {
     _context.Gigs.Add(gigs);
 }