public IActionResult PracticeSongRequest([FromBody] PracticeSongRequest request) { if (request == null || string.IsNullOrWhiteSpace(request.SongName) || string.IsNullOrWhiteSpace(request.Username) ) { _logger.LogError("PracticeSongRequest received an invalid request", request); return(BadRequest()); } try { _azureDevOpsService.RaisePracticeSongRequest(request.Username, new DevOpsProductBacklogItem { Title = request.SongName, Description = request.ExtraInformation, Tags = new List <string> { "Song Request" } }); } catch (Exception e) { _logger.LogError(e, $"Error in PracticeSongRequest when raising pbi in DevOps", request); return(BadRequest()); } return(Ok()); }
public async Task <bool> PracticeSongRequest(PracticeSongRequest practiceSongRequest) { try { var result = await _client.PostAsync("PracticeSongRequest", HttpClientHelper.GetJsonData(practiceSongRequest)); return(result.IsSuccessStatusCode); } catch (Exception e) { return(HttpClientHelper.LogError <bool>(_logger, e, new object[] { practiceSongRequest.SongName, practiceSongRequest.ExtraInformation, practiceSongRequest.Username })); } }