public static void Save(JobPosting jobPosting)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ContosoHR"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SaveJobPosting";

                command.Parameters.Add(new SqlParameter("@id", jobPosting.Id));
                command.Parameters.Add(new SqlParameter("@hiringRequestId", jobPosting.HiringRequestInfo.Id));
                command.Parameters.Add(new SqlParameter("@title", jobPosting.Title));
                command.Parameters.Add(new SqlParameter("@description", jobPosting.Description));
                command.Parameters.Add(new SqlParameter("@status", jobPosting.Status));

                command.ExecuteNonQuery();
            }
        }
Пример #2
0
        public static void Save(JobPosting jobPosting)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ContosoHR"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SaveJobPosting";

                command.Parameters.Add(new SqlParameter("@id", jobPosting.Id));
                command.Parameters.Add(new SqlParameter("@hiringRequestId", jobPosting.HiringRequestInfo.Id));
                command.Parameters.Add(new SqlParameter("@title", jobPosting.Title));
                command.Parameters.Add(new SqlParameter("@description", jobPosting.Description));
                command.Parameters.Add(new SqlParameter("@status", jobPosting.Status));

                command.ExecuteNonQuery();
            }
        }