コード例 #1
0
        public void UpgradeDate(ArtistRequest request)
        {
            var musician = _context.ArtistEvents
                           .Include(x => x.Event)
                           .SingleOrDefault(m => m.IdArtist == request.IdArtist &&
                                            m.IdEvent == request.IdEvent);

            if (musician == null)
            {
                throw new ArtistDoesNotExistException($"Artist with this ID does not exists!");
            }

            if (request.PerformanceDate < DateTime.Now)
            {
                throw new Exception("Invalid Performancedate!");
            }

            if (musician.Event.StartDate < request.PerformanceDate || musician.Event.EndDate > request.PerformanceDate)
            {
                throw new Exception("Invalid Performancedate!");
            }

            musician.PerformanceDate = request.PerformanceDate;

            _context.SaveChanges();
        }
コード例 #2
0
        public String PostArtist(ArtistRequest request)
        {
            if (_context.Cities.Find(request.idCity) == null)
            {
                return("NOCITY");
            }

            if (_context.ArtMovements.Find(request.idArtMovement) == null)
            {
                return("NOMOVE");
            }

            if (_context.Artists.Where(a => a.Nickname == request.nickname).Equals(null))
            {
                return("NICK");
            }

            Artist NewArtist = new Artist();

            NewArtist.City        = _context.Cities.Find(request.idCity);
            NewArtist.FirstName   = request.firstName;
            NewArtist.LastName    = request.lastName;
            NewArtist.Nickname    = request.nickname;
            NewArtist.DateOfBirth = request.dateOfBirth;
            NewArtist.ArtMovement = _context.ArtMovements.Find(request.idArtMovement);
            _context.Artists.Add(NewArtist);
            _context.SaveChanges();

            return("SUCCESS");
        }
コード例 #3
0
        public Task <Artist> Handle(ArtistRequest request, CancellationToken cancellationToken)
        {
            var artists = _artistRepository.Where(artist => artist.Id == request.Id)
                          .First();

            return(Task.FromResult(_objectMapper.Map <Artist>(artists)));
        }
コード例 #4
0
        private async void GetArtistAlbums(int id)
        {
            currentArtist.Albums = await ArtistRequest.GetAlbums(id);

            ArtistDetails.DataContext = null;
            ArtistDetails.DataContext = currentArtist;
        }
コード例 #5
0
        public async Task <ActionResult> Edit(Artist artist)
        {
            var    auth     = GetCookies();
            string imageUrl = null;

            try
            {
                //We're not attaching the profile image url until this point. If you don't save, it gets orphaned
                var imageId = await _imageService.GetProfileImage(artist.Id);

                if (imageId != "")
                {
                    imageUrl = _imageService.GetImage("ProfileImage/" + imageId);
                }

                artist.ImageUrl = imageUrl;

                var artistRequest = new ArtistRequest()
                {
                    Auth   = auth,
                    Artist = artist
                };
                await _artistService.EditArtist(artistRequest);

                return(RedirectToAction("Details"));
            }
            catch
            {
                //TODO errors
                return(View());
            }
        }
コード例 #6
0
        private async void GetArtistDetails(int id)
        {
            currentArtist = await ArtistRequest.GetDetails(id);

            ArtistDetails.DataContext = currentArtist;
            GetArtistAlbums(id);
            GetArtistSongs(id);
        }
コード例 #7
0
        public IActionResult UpdateMusicLabel([FromBody] ArtistRequest request)
        {
            try
            {
                _dbService.UpgradeDate(request);

                return(Ok());
            }
            catch (MusicLabelDoesNotExistException e)
            {
                return(NotFound(e.Message));
            }
        }
コード例 #8
0
        private async void GetArtistSongs(int id)
        {
            List <SongListItem> songs = await ArtistRequest.GetSongs(id);

            currentArtist.Songs = songs;
            if (songs.Count() != 0)
            {
                currentArtist.ImageSource = songs.OrderByDescending(x => x.ReleaseDate).First().ImageSource;
                ArtistImage.Source        = new BitmapImage(new Uri(currentArtist.ImageSource.Sizex60));
            }
            ArtistDetails.DataContext = null;
            ArtistDetails.DataContext = currentArtist;
        }
コード例 #9
0
        public IActionResult PostArtist(ArtistRequest request)
        {
            var response = _service.PostArtist(request);

            switch (response)
            {
            case "NOCITY":
                return(NotFound("No such city"));

            case "NOMOVE":
                return(NotFound("No such art movement"));

            case "NICK":
                return(BadRequest("Nickname already exists"));

            case "SUCCESS":
                return(Ok(response));

            default:
                return(Ok(response));
            }
        }
コード例 #10
0
        public async Task <ActionResult> Create(Artist artist)
        {
            var auth = GetCookies();

            artist.Id = auth["uid"];
            try
            {
                var artistRequest = new ArtistRequest()
                {
                    Auth   = auth,
                    Artist = artist
                };
                await _artistService.AddArtist(artistRequest);

                return(RedirectToAction("Details"));
            }
            catch
            {
                //TODO send in error back to view
                return(View());
            }
        }
コード例 #11
0
 /// <summary>
 /// Edits the artist
 /// </summary>
 /// <param name="artistRequest"></param>
 /// <returns></returns>
 public async Task EditArtist(ArtistRequest artistRequest)
 {
     var json           = JsonSerializer.Serialize(artistRequest.Artist);
     var artistResponse = await _dataService.ApiGoogle("PATCH", json, "Artists/" + artistRequest.Auth["uid"], artistRequest.Auth);
 }
コード例 #12
0
        static void Main(string[] args)
        {
            var settings = GetSettings();

            var request = new SetlistRequest(settings);
            Task <Base <Setlist> > show;
            // Get Most Recent
            //show = request.GetMostRecent();
            //Console.WriteLine(show.Result);

            // Get Specific Show
            // show = request.GetSetlist(1252698446);

            // Get Recent With Limit
            // show = request.GetRecentSetlists(5);

            // Get TIPH
            // show = request.GetTodayInPhishHistory();

            // GetRandom
            // show = request.GetRandomSetlist();

            // Get Most Recent, Including in progress
            // show = request.GetRecentInProgress();

            var artistsRequest = new ArtistRequest(settings);
            Task <ArtistData> artists;
            // Get All Artists
            //artists = artistsRequest.GetAllArtists();
            //Console.WriteLine(artists.Result);

            //Console.WriteLine(show.Result);


            var attendanceRequest = new AttendanceRequest(settings);
            Task <Base <Attendance> > attendance;

            //attendance = attendanceRequest.GetAttendance();
            attendance = attendanceRequest.GetAttendance("1999-12-07");
            //Console.WriteLine(attendance.Result);


            var blogRequest = new BlogRequest(settings);
            Task <Base <Blog> > blogs;

            //blogs = blogRequest.Get(monthname: "july");
            //Console.WriteLine(blogs.Result);

            var collectionRequest = new CollectionRequest(settings);
            Task <Base <QueryCollection> > collections;

            //collections = collectionRequest.QueryCollections(contains: "phish");
            //Console.WriteLine(collections.Result);

            var singleCollectionRequest = new SingleCollectionRequest(settings);
            Task <SingleDataBase <SingleCollection> > getCollections;
            //getCollections = singleCollectionRequest.Get(1294148902);
            //Console.WriteLine(getCollections.Result);

            var jamChartRequest = new JamChartRequest(settings);

            //var jamCharts = jamChartRequest.GetAll();
            //Console.WriteLine(jamCharts.Result);

            jamChartRequest = new JamChartRequest(settings);
            //var singleChart = jamChartRequest.GetSingle("8");
            //Console.WriteLine(singleChart.Result);

            var peopleRequest = new PeopleRequest(settings);
            //var people = peopleRequest.GetAll();
            //Console.WriteLine(people.Result);

            //var peopleTypes = peopleRequest.GetPeopleTypes();
            //Console.WriteLine(peopleTypes.Result);

            //var reviewRequest = new ReviewRequest(settings);
            //var reviews = reviewRequest.QueryReviews(showid: 1605919636);
            //Console.WriteLine(reviews.Result);

            //var relRequest = new RelationshipRequest(settings);
            //var relations = relRequest.Get(751);
            //Console.WriteLine(relations.Result);

            //var showsRequest = new ShowLinksRequest(settings);
            //var shows = showsRequest.GetShowLinks(1569515741);
            //Console.WriteLine(shows.Result);

            //var showDataRequest = new ShowDataRequest(settings);
            //var shows = showDataRequest.GetUpcomingShows();
            //Console.WriteLine(shows.Result);

            //var showQueryRequest = new ShowQueryRequest(settings);
            //var shows = showQueryRequest.QueryShows(state: "ME");
            //Console.WriteLine(shows.Result);

            var venueRequest = new VenueRequest(settings);
            //var venue = venueRequest.Get(1);
            //Console.WriteLine(venue.Result);

            var venues = venueRequest.GetAll();

            Console.WriteLine(venues.Result);

            Console.ReadKey();
        }
コード例 #13
0
 public System.IAsyncResult BeginArtistSearchRequest(ArtistRequest ArtistSearchRequest, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("ArtistSearchRequest", new object[] {
         ArtistSearchRequest}, callback, asyncState);
 }
コード例 #14
0
 public ProductInfo ArtistSearchRequest(ArtistRequest ArtistSearchRequest)
 {
     object[] results = this.Invoke("ArtistSearchRequest", new object[] {
         ArtistSearchRequest});
     return ((ProductInfo)(results[0]));
 }