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 object CreateProducer(JObject json) { try { MovieOperationsDAL mo_dal = new MovieOperationsDAL(); DataTable dtActorsList = new DataTable(); string PRODUCER_NAME = (json["PRODUCER_NAME"].ToString()); string PRODUCER_GENDER = (json["PRODUCER_GENDER"].ToString()); string PRODUCER_DOB = (json["PRODUCER_DOB"].ToString()); string PRODUCER_BIO = (json["PRODUCER_BIO"].ToString()); int iRowsEffected = mo_dal.CreateProducer(PRODUCER_NAME, PRODUCER_GENDER, PRODUCER_DOB, PRODUCER_BIO, "Admin"); if (iRowsEffected > 0) { return new { Message = "Success", MessageReason = "Successfully Created movie." } } ; else { return new { Message = "error", MessageReason = "Insert failed." } }; } catch (Exception ex) { string error = " API - updatemovie " + ex.Message; return(new { Message = "error", MessageReason = "There was some problem. Please refresh try again! <br>" + error }); } }
public object CreateMovie(JObject json) { try { MovieOperationsDAL mo_dal = new MovieOperationsDAL(); DataTable dtActorsList = new DataTable(); string MOVIE_NAME = (json["MOVIE_NAME"].ToString()); string MOVIE_YOR = (json["MOVIE_YOR"].ToString()); string MOVIE_PLOT = (json["MOVIE_PLOT"].ToString()); string MOVIE_POSTER = (json["MOVIE_POSTER"].ToString()); int PRODUCER_ANID = int.Parse(json["PRODUCER_ANID"].ToString()); string ACTORS_ANIDS = (json["ACTORS_ANIDS"].ToString()); int iRowsEffected = mo_dal.CreateMovie(MOVIE_NAME, MOVIE_YOR, MOVIE_PLOT, MOVIE_POSTER, PRODUCER_ANID, ACTORS_ANIDS, "Admin"); if (iRowsEffected > 0) { return new { Message = "success", MessageReason = "Successfully Created movie." } } ; else { return new { Message = "error", MessageReason = "Insert failed." } }; } catch (Exception ex) { string error = " API - updatemovie " + ex.Message; return(new { Message = "error", MessageReason = "There was some problem. Please refresh try again! <br>" + error }); } }
public object getMoviesList() { try { MovieOperationsDAL mo_dal = new MovieOperationsDAL(); DataTable dtMovieDetails = new DataTable(); List <MovieDetails> lstMovieDetails = new List <MovieDetails>(); dtMovieDetails = mo_dal.GetMoviesList(); for (int i = 0; i < dtMovieDetails.Rows.Count; i++) { MovieDetails md = new MovieDetails(); md.Name = dtMovieDetails.Rows[i]["Name"].ToString(); md.Year = dtMovieDetails.Rows[i]["Year"].ToString(); md.Actors = dtMovieDetails.Rows[i]["Actors"].ToString(); md.Producer = dtMovieDetails.Rows[i]["Producer"].ToString(); md.Poster = String.Format("<div align=center><img src='{0}' width='50' vspace='5'></div>", dtMovieDetails.Rows[i]["Poster"].ToString()); md.Actions = dtMovieDetails.Rows[i]["Actions"].ToString(); lstMovieDetails.Add(md); } return(new { Message = "Success", MovieList = lstMovieDetails }); } catch (Exception ex) { string error = " API - getmovieslist " + ex.Message; return(new { Message = "error", MessageReason = "There was some problem loading data. Please refresh try again! <br>" + error }); } }
public object getActorList() { try { MovieOperationsDAL mo_dal = new MovieOperationsDAL(); DataTable dtActorsList = new DataTable(); dtActorsList = mo_dal.GetActorsList(); if (dtActorsList.Rows.Count > 0) { return new { Message = "Success", ActorsList = DataTableToJSONWithJavaScriptSerializer(dtActorsList) } } ; else { return new { Message = "error", MessageReason = "No Actor avilable." } }; } catch (Exception ex) { string error = " API - getactorlist " + ex.Message; return(new { Message = "error", MessageReason = "There was some problem loading data. Please refresh try again! <br>" + error }); } }