// PUT api/Ratings/ [HttpPost] public void Post([FromBody] RatingDTO dto) { /// /// Load the string to RatingDTO /// To Query the List using the id /// If Found update, if not Insert /// var row = data.Where(x => x.id == dto.beerid).FirstOrDefault(); if(row==null) { BeerWithRatingsDTO temp = new BeerWithRatingsDTO(); temp.comments.Add(new RatingShortDTO() { username = dto.username, userrating = dto.userrating, comment =...
To PUT update to the API???? public async Task<bool> SaveRating(BeerRatingDTO dto) { v ar response = await _client.PutAsJsonAsync<BeerRatingDTO> (AppSettings.WebApiBaseAddress + "BeerRatings", dto); if (response.IsSuccessStatusCode) return true; return false; }