public bool UpdateAbout(AboutUs aboutUs) { bool isUpdate = true; using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString)) { SqlCommand command = new SqlCommand(StoreProcedure.UpdateAbout, connection); command.CommandType = CommandType.StoredProcedure; foreach (var about in aboutUs.GetType().GetProperties()) { string name = about.Name; var value = about.GetValue(aboutUs, null); command.Parameters.Add(new SqlParameter("@" + name, value == null ? DBNull.Value : value)); } try { connection.Open(); command.ExecuteNonQuery(); } catch (Exception e) { isUpdate = false; throw new Exception("Exception Updating Data." + e.Message); } finally { connection.Close(); } } return(isUpdate); }