public object getMovieDetails(string movieid) { try { int MOVIE_ID = 0; MovieOperationsDAL mo_dal = new MovieOperationsDAL(); DataTable dtMovieDetails = new DataTable(); if (movieid.Length > 0) { MOVIE_ID = int.Parse(movieid); } else { return(new { Message = "error", MessageReason = "No movie found" }); } dtMovieDetails = mo_dal.GetMovieCrew(MOVIE_ID); string actorAnids = string.Empty; List <GetMovieDetails> lstMD = new List <GetMovieDetails>(); foreach (DataRow dr in dtMovieDetails.Rows) { GetMovieDetails gmd = new GetMovieDetails(); gmd.MOVIE_ANID = dr["MOVIE_ANID"].ToString(); gmd.MOVIE_NAME = dr["MOVIE_NAME"].ToString(); gmd.MOVIE_PLOT = dr["MOVIE_PLOT"].ToString(); gmd.MOVIE_POSTER = dr["MOVIE_POSTER"].ToString(); gmd.MOVIE_YOR = dr["MOVIE_YOR"].ToString(); gmd.PRODUCER_ANID = dr["PRODUCER_ANID"].ToString(); gmd.PRODUCER_NAME = dr["PRODUCER_NAME"].ToString(); gmd.CREWUNION_ANID = dr["CREWUNION_ANID"].ToString(); actorAnids = dr["ACTOR_ANIDS"].ToString().TrimEnd(','); lstMD.Add(gmd); } string[] actorAnid = actorAnids.Split(','); List <actor_ANIDs> lstACTORS = new List <actor_ANIDs>(); for (int i = 0; i < actorAnid.Length; i++) { actor_ANIDs ai = new actor_ANIDs(); ai.ACTOR_ANID = actorAnid[i].ToString(); lstACTORS.Add(ai); } if (dtMovieDetails.Rows.Count > 0) { return new { Message = "success", MovieDetails = lstMD, actorAnids = lstACTORS } } ; else { return new { message = "error", MessageReason = "No movie avilable" } }; } catch (Exception ex) { string error = " API - getmoviedetails " + ex.Message; return(new { Message = "error", MessageReason = "There was some problem loading the data. Please try again! <br> " + error }); } }
public void GetMovieDetailsTest() { GetMovieDetails request = new GetMovieDetails(); var result = JsonConvert.DeserializeObject <KodiJSON.VideoLibrary.Response.GetMovieDetailsResponse>(ExecuteTest.GetResponse(request)); }