Esempio n. 1
0
 //UPDATE RECOMMENDATION
 public static int UpdateRecommendation(Recommendation recommendation)
 {
     try
     {
         command.CommandText = $"UPDATE RECOMMENDATIONS " +
                               $" SET USER_ID = {recommendation.UserId} , " +
                               $" DESTINATION_CODE = {recommendation.DestinationCode} ," +
                               $" DESCRIPTION = N'{recommendation.Description}' , " +
                               $" POST_IMAGE = N'{recommendation.PostImage}' ," +
                               $" UPLOAD_DATE = '{recommendation.UploadDate}' " +
                               $" WHERE RECO_ID = {recommendation.RecoId}";
         con.Open();
         int rowsAffected = command.ExecuteNonQuery();
         return(rowsAffected);
     }
     finally
     {
         if (con.State == ConnectionState.Open)
         {
             con.Close();
         }
     }
 }
Esempio n. 2
0
        //READ ONE RECOMMENDATION BY ID
        public static Recommendation GetRecommendationById(int RECO_ID)
        {
            Recommendation countryToReturn = ExecReader($"SELECT * FROM RECOMMENDATIONS   WHERE RECO_ID = {RECO_ID} ").FirstOrDefault();

            return(countryToReturn);
        }