public void Dispose() { Gigs.Dispose(); Attendances.Dispose(); Followings.Dispose(); Genres.Dispose(); UserNotifications.Dispose(); Users.Dispose(); Roles.Dispose(); // UserDescriptions.Dispose(); }
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>(); }
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>(); }
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>(); }
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(); }
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); }
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(); }
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"); }
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(); }
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")); }
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); }
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")); }
public void Add(Gigs gigs) { _context.Gigs.Add(gigs); }