public async Task <IActionResult> DirectInsertSong([FromBody] PoemMusicTrackViewModel song) { var res = await _ganjoorService.DirectInsertSong(song); if (!string.IsNullOrEmpty(res.ExceptionString)) { return(BadRequest(res.ExceptionString)); } return(Ok(res.Result)); }
private async Task _GetSuggestedSongs() { var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{PoemId}/songs/?approved=false&trackType={(int)PoemMusicTrackType.Spotify}"); if (response.StatusCode == HttpStatusCode.OK) { SuggestedSongs = JsonConvert.DeserializeObject <PoemMusicTrackViewModel[]>(await response.Content.ReadAsStringAsync()); } else { SuggestedSongs = new PoemMusicTrackViewModel[] { }; } }
public void OnGet() { PoemMusicTrackViewModel = new PoemMusicTrackViewModel() { TrackType = RMuseum.Models.Ganjoor.PoemMusicTrackType.BeepTunesOrKhosousi, PoemId = 0, ArtistName = "محمدرضا شجریان", ArtistUrl = "http://beeptunes.com/artist/3403349", AlbumName = "اجراهای خصوصی", AlbumUrl = "http://khosousi.com", TrackName = "", TrackUrl = "", Approved = false, Rejected = false, BrokenLink = false, Description = "" }; }
public async Task <IActionResult> SuggestSong([FromBody] PoemMusicTrackViewModel song) { Guid userId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value); Guid sessionId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "SessionId").Value); RServiceResult <bool> sessionCheckResult = await _appUserService.SessionExists(userId, sessionId); if (!string.IsNullOrEmpty(sessionCheckResult.ExceptionString)) { return(StatusCode((int)HttpStatusCode.Forbidden)); } var res = await _ganjoorService.SuggestSong(userId, song); if (!string.IsNullOrEmpty(res.ExceptionString)) { return(BadRequest(res.ExceptionString)); } return(Ok(res.Result)); }
public IActionResult OnGet() { if (string.IsNullOrEmpty(Request.Cookies["Token"])) { return(Redirect("/")); } PoemMusicTrackViewModel = new PoemMusicTrackViewModel() { TrackType = RMuseum.Models.Ganjoor.PoemMusicTrackType.BeepTunesOrKhosousi, PoemId = 0, ArtistName = "محمدرضا شجریان", ArtistUrl = "https://beeptunes.com/artist/3403349", AlbumName = "اجراهای خصوصی", AlbumUrl = "https://khosousi.com", TrackName = "", TrackUrl = "", Approved = false, Rejected = false, BrokenLink = false, Description = "" }; return(Page()); }