[HttpGet("GetActorByName/{actorName}/")] //Route: WebAPI/TermProject/GetActorByName/ public List <Actors> GetActorByName(string actorName) { DataSet myDS = new DataSet(); StoredProcedures stoPros = new StoredProcedures(); //string query = "SELECT * FROM TP_Actor"; myDS = stoPros.getActorByName(actorName); DBConnect objDB = new DBConnect(); //DataSet ds = objDB.GetDataSet(query); Actors actor = new Actors(); List <Actors> dpts = new List <Actors>(); foreach (DataRow dr in myDS.Tables[0].Rows) { actor = new Actors(); actor.ActorID = int.Parse(dr["Actor_ID"].ToString()); actor.ActorName = dr["Actor_Name"].ToString(); actor.ActorBirthCity = dr["Actor_Birth_City"].ToString(); actor.ActorBirthCountry = dr["Actor_Birth_Country"].ToString(); actor.ActorBirthState = dr["Actor_Birth_State"].ToString(); actor.ActorDOB = dr["Actor_DOB"].ToString(); actor.ActorHeight = dr["Actor_Height"].ToString(); actor.ActorImage = dr["Actor_Image"].ToString(); actor.ActorDescription = dr["Actor_Description"].ToString(); dpts.Add(actor); } return(dpts); } //end of GetActors
public Boolean UpdateActor([FromBody] Actors actors) { if (actors != null) { DBConnect objDB = new DBConnect(); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "TP_UpdateActor"; objCommand.Parameters.AddWithValue("@Member_ID", actors.MemberID); objCommand.Parameters.AddWithValue("@Actor_ID", actors.ActorID); objCommand.Parameters.AddWithValue("@Actor_Image", actors.ActorImage); objCommand.Parameters.AddWithValue("@Actor_Name", actors.ActorName); objCommand.Parameters.AddWithValue("@Actor_Description", actors.ActorDescription); objCommand.Parameters.AddWithValue("@Actor_Height", actors.ActorHeight); objCommand.Parameters.AddWithValue("@Actor_DOB", actors.ActorDOB); objCommand.Parameters.AddWithValue("@Actor_Birth_City", actors.ActorBirthCity); objCommand.Parameters.AddWithValue("@Actor_Birth_State", actors.ActorBirthState); objCommand.Parameters.AddWithValue("@Actor_Birth_Country", actors.ActorBirthCountry); int retVal = objDB.DoUpdateUsingCmdObj(objCommand); if (retVal > 0) { return(true); } else { return(false); } } else { return(false); } }