private static ApiRequest PopulateTerm(ApiRequest request, EnrollmentTermRequest term) { return(request .Param("enrollment_term[name]", term.Name) .Param("enrollment_term[start_at]", term.StartAt) .Param("enrollment_term[end_at]", term.EndAt) .Param("enrollment_term[sis_term_id]", term.SisTermId)); }
public async Task CreateEnrollmentTerm() { var enrollmentTerm = new EnrollmentTermRequest() { Name = "Test Term Y", StartAt = DateTime.Now, EndAt = DateTime.Now.AddMonths(3) }; var term = await _client.AccountsManager.CreateEnrollmentTerm(AccountId, enrollmentTerm); Console.Out.WriteLine(term); }
/// <summary> /// Create an enrollment term /// </summary> /// <param name="accountId">The ID of the account</param> /// <param name="term">The term to create</param> /// <returns></returns> public async Task <EnrollmentTerm> CreateEnrollmentTerm(long accountId, EnrollmentTermRequest term) { accountId.ThrowIfUnassigned("accountId"); term.ThrowIfNull("term"); var request = new ApiRequest(_config.AccountsEndpointUri, accountId + "/terms") .Method(RequestMethod.Post); request = PopulateTerm(request, term); return(await GetReponseAsync <EnrollmentTerm>(request).ConfigureAwait(false)); }
public async Task CreateEnrollmentTerm() { var enrollmentTerm = new EnrollmentTermRequest(){Name = "Test Term Y", StartAt = DateTime.Now, EndAt = DateTime.Now.AddMonths(3) }; var term = await _client.AccountsManager.CreateEnrollmentTerm(AccountId, enrollmentTerm); Console.Out.WriteLine(term); }