public async Task UpdateRatingAsync(Rating rating)
 {
     await httpClient.PutAsJsonAsync("ratings/list", rating);
 }
 public void UpdateRating(Rating rating)
 {
     throw new NotImplementedException();
 }
 public Rating AddRating(Rating rating)
 {
     throw new NotImplementedException();
 }
        public async Task<Rating> AddRatingAsync(Rating rating)
        {
            var response = await httpClient.PostAsJsonAsync("ratings/list", rating);
            var result = await response.Content.ReadAsAsync<Rating>();

            return result;
        }
        private async void OnCurrentSessionChanged(object sender, EventArgs e)
        {
            if (this.Ratings == null) return;

            // Änderungen des zuletzt selektierten Ratings speichern
            if (this.CurrentRating != null)
            {
                if (_currentRatingHasChanges)
                {
                    this.IsBusy = true;
                    if (this.CurrentRating.Id == 0)
                    {
                        var rating = this.CurrentRating;
                        var newRating = await _sessionService.AddRatingAsync(rating);
                        rating.Id = newRating.Id;
                    }
                    else
                        await _sessionService.UpdateRatingAsync(this.CurrentRating);
                    _currentRatingHasChanges = false;
                    this.IsBusy = false;
                }
                this.CurrentRating.PropertyChanged -= this.OnCurrentRatingPropertyChanged;
            }

            var session = this.SessionsView.CurrentItem as SessionDto;
            if (session != null)
            {
                this.CurrentRating = null;
                var rating = (from r in this.Ratings where r.SessionId.Equals(session.SessionBaseId) select r).FirstOrDefault();
                this.CurrentRating = rating;
                if (this.CurrentRating == null && session.Speaker1Id > 0)
                {
                    var newRating = new Rating() { SessionId = session.SessionBaseId, SpeakerId = session.Speaker1Id };
                    this.Ratings.Add(newRating);
                    this.CurrentRating = newRating;
                }
                if (this.CurrentRating != null)
                    this.CurrentRating.PropertyChanged += this.OnCurrentRatingPropertyChanged;
            }
        }