Changeset 73ed58e941d5…
Parent 492258920646…
by Clayton Miller <clayton.miller@nexportengineering.com>
Changes to 43 files · Browse files at 73ed58e941d5 Showing diff from parent 492258920646 Diff from another changeset...
|
@@ -0,0 +1,61 @@ + <?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{7F7AD021-87AB-493A-A4E5-E2E73A844852}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NexportWebApiDemo.ApiModels</RootNamespace>
+ <AssemblyName>NexportWebApiDemo.ApiModels</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <StartupObject />
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="v1\WebApiModels.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file |
|
@@ -1,61 +0,0 @@ - <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{7F7AD021-87AB-493A-A4E5-E2E73A844852}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>NexportWebApiDemo.Models</RootNamespace>
- <AssemblyName>NexportWebApiDemo.Models</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup>
- <StartupObject />
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="v1\WebApiModels.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file |
|
|
Change 1 of 1
|
||
---|---|---|
|
@@ -0,0 +1,6 @@ + <?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+ </startup>
+</configuration>
\ No newline at end of file |
|
|
|
|
|
|
Change 1 of 1
|
||
---|---|---|
|
@@ -0,0 +1,6 @@ + C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\bin\Debug\NexportWebApiDemo.ApiModels.dll.config
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\bin\Debug\NexportWebApiDemo.ApiModels.dll
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\bin\Debug\NexportWebApiDemo.ApiModels.pdb
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\obj\Debug\NexportWebApiDemo.ApiModels.csprojResolveAssemblyReference.cache
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\obj\Debug\NexportWebApiDemo.ApiModels.dll
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\obj\Debug\NexportWebApiDemo.ApiModels.pdb
|
|
|
|
|
|
|
|
|
|
|
@@ -1,6 +1,8 @@ using System;
+using System.Collections;
+using System.Collections.Generic;
-namespace NexportWebApiDemo.Models.v1
+namespace NexportWebApiDemo.ApiModels.v1
{
public class WAAuthTokenRequest
{
@@ -25,4 +27,34 @@ public string last_name { get; set; }
public string email { get; set; }
}
+
+ public class CatalogRequest
+ {
+ public Guid group_id { get; set; }
+ public int availability { get; set; }
+ public int publishing_model { get; set; }
+ }
+
+ public class CatalogResponse
+ {
+ public IList<Guid> catalogs { get; set; }
+ public Guid id { get; set; }
+ }
+
+ public class CatalogResponseItem
+ {
+ public Guid org_id { get; set; }
+ public string org_name { get; set; }
+ public string org_short_name { get; set; }
+ public bool is_enabled { get; set; }
+ public string name { get; set; }
+ public DateTime date_created { get; set; }
+ public Guid owner_id { get; set; }
+ public string owner_name { get; set; }
+ public Guid modified_by_id { get; set; }
+ public DateTime last_modified { get; set; }
+ public int pricing_model { get; set; }
+ public TimeSpan? access_time_limit { get; set; }
+ public int publishing_model { get; set; }
+ }
}
|
@@ -1,8 +1,8 @@ using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Web;
using System.Web.Mvc;
+using NexportWebApiDemo.ApiModels.v1;
+using NexportWebApiDemoClient;
namespace NexportWebApiDemo.Controllers
{
@@ -11,6 +11,28 @@ public ActionResult Index()
{
ViewBag.Title="NexportWebApiDemo";
+ var authRequest = new WAAuthTokenRequest()
+ {
+ username = "Clay0M",
+ grant_type = "password",
+ password = "password"
+ };
+
+ var authToken = WebApiRequests.Authenticate(authRequest);
+ var catRequest = new CatalogRequest()
+ {
+ group_id = new Guid("ed5ba4ac-73e4-4e64-837f-b26cb8ef3c4b"),
+ availability = 2,
+ publishing_model = 0
+ };
+
+ var catResponse = WebApiRequests.GetCatalogIds(catRequest, authToken.access_token);
+ var catalogs = new List<CatalogResponseItem>();
+ for (var i = 0; i < 30; i++)
+ {
+ catalogs.Add(WebApiRequests.GetCatalog(catResponse.catalogs[i], authToken.access_token));
+ }
+ ViewBag.Catalogs = catalogs;
return View();
}
}
|
@@ -235,6 +235,16 @@ <ItemGroup>
<Content Include="Views\Home\Index.cshtml" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NexportWebApiDemo.Models\NexportWebApiDemo.ApiModels.csproj">
+ <Project>{7F7AD021-87AB-493A-A4E5-E2E73A844852}</Project>
+ <Name>NexportWebApiDemo.ApiModels</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\NexportWebApiDemoClient\NexportWebApiDemoClient.csproj">
+ <Project>{204EFCCB-1C1C-45E4-ACE8-CA6166A03C53}</Project>
+ <Name>NexportWebApiDemoClient</Name>
+ </ProjectReference>
+ </ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
@@ -14,7 +14,7 @@ {7F7AD021-87AB-493A-A4E5-E2E73A844852} = {7F7AD021-87AB-493A-A4E5-E2E73A844852}
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexportWebApiDemo.Models", "..\NexportWebApiDemo.Models\NexportWebApiDemo.Models.csproj", "{7F7AD021-87AB-493A-A4E5-E2E73A844852}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexportWebApiDemo.ApiModels", "..\NexportWebApiDemo.Models\NexportWebApiDemo.ApiModels.csproj", "{7F7AD021-87AB-493A-A4E5-E2E73A844852}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
|
@@ -1,4 +1,6 @@ - <!DOCTYPE html>
+@{ var catalogs = @ViewBag.Catalogs; }
+
+<!DOCTYPE html>
<html lang="en">
<head>
@@ -70,8 +72,25 @@
<div class="col-md-9">
- <div class="row">
-
+ <div class="row">
+
+
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th>Catalog</th>
+ <th>Organization</th>
+ <th>Date Created</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>@catalogs[0].name</td>
+ <td>@catalogs[0].org_name</td>
+ <td>@catalogs[0].date_created</td>
+ </tr>
+ </tbody>
+ </table>
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/320x150" alt="">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Change 1 of 1
Show Entire File
NexportWebApiDemo/obj/Debug/NexportWebApiDemo.csproj.FileListAbsolute.txt
Stacked
|
||
---|---|---|
@@ -47,3 +47,7 @@ C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo\obj\Debug\NexportWebApiDemo.dll
C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo\obj\Debug\NexportWebApiDemo.pdb
C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo\obj\Debug\NexportWebApiDemo.csprojResolveAssemblyReference.cache
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo\bin\NexportWebApiDemo.ApiModels.dll
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo\bin\NexportWebApiDemoClient.exe
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo\bin\NexportWebApiDemo.ApiModels.pdb
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo\bin\NexportWebApiDemoClient.pdb
|
|
|
|
|
|
|
@@ -59,9 +59,9 @@ <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\NexportWebApiDemo.Models\NexportWebApiDemo.Models.csproj">
+ <ProjectReference Include="..\NexportWebApiDemo.Models\NexportWebApiDemo.ApiModels.csproj">
<Project>{7F7AD021-87AB-493A-A4E5-E2E73A844852}</Project>
- <Name>NexportWebApiDemo.Models</Name>
+ <Name>NexportWebApiDemo.ApiModels</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
@@ -2,7 +2,7 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
-using NexportWebApiDemo.Models.v1;
+using NexportWebApiDemo.ApiModels.v1;
namespace NexportWebApiDemoClient
{
@@ -36,6 +36,17 @@
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t", getUserResponse.first_name, getUserResponse.middle_name,
getUserResponse.last_name, getUserResponse.email);
+
+ var catalogRequest = new CatalogRequest()
+ {
+ group_id = new Guid("f60904d7-0164-41cc-a246-46aa21a49af9"),
+ availability = 2,
+ publishing_model = 1
+ };
+
+ var getCatalogIdsResponse = WebApiRequests.GetCatalogIds(catalogRequest, accessToken);
+
+ Console.WriteLine(getCatalogIdsResponse.catalogs);
}
}
}
|
@@ -5,11 +5,11 @@ using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
-using NexportWebApiDemo.Models.v1;
+using NexportWebApiDemo.ApiModels.v1;
namespace NexportWebApiDemoClient
{
- class WebApiRequests
+ public class WebApiRequests
{
private static string BaseUri = "http://local.nexportcampus.com/api/v1/";
@@ -35,5 +35,41 @@ return response.Content.ReadAsAsync<GetUserResponse>().Result;
}
}
+
+ public static CatalogResponse GetCatalogIds(CatalogRequest request, Guid accessToken, int page = 1, int perPage = 30)
+ {
+ using (var client = new HttpClient())
+ {
+ var requestUri = BaseUri + "LearningApi/GetCatalogIds?access_token=" + accessToken + "&page=" + page +
+ "&per_page=" + perPage;
+ var response = client.PostAsJsonAsync(requestUri, request).Result;
+
+ return response.Content.ReadAsAsync<CatalogResponse>().Result;
+ }
+ }
+
+ public static CatalogResponseItem GetCatalog(Guid catalogId, Guid accessToken)
+ {
+ using (var client = new HttpClient())
+ {
+ var requestUri = BaseUri + "LearningApi/GetCatalog?catalog_id=" + catalogId + "&access_token=" +
+ accessToken;
+ var response = client.GetAsync(requestUri).Result;
+
+ return response.Content.ReadAsAsync<CatalogResponseItem>().Result;
+ }
+ }
+
+ public static string GetCatalogDescription(Guid catalogId, Guid accessToken)
+ {
+ using (var client = new HttpClient())
+ {
+ var requestUri = BaseUri + "LearningApi/GetCatalogDescription?catalog_id=" + catalogId +
+ "&access_token=" + accessToken;
+ var response = client.GetAsync(requestUri).Result;
+
+ return response.Content.ReadAsStringAsync().Result;
+ }
+ }
}
}
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -8,5 +8,5 @@ C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\obj\Debug\NexportWebApiDemoClient.csprojResolveAssemblyReference.cache
C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\obj\Debug\NexportWebApiDemoClient.exe
C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\obj\Debug\NexportWebApiDemoClient.pdb
-C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemo.Models.dll
-C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemo.Models.pdb
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemo.ApiModels.dll
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemo.ApiModels.pdb
|
|
|
|
|
|
|
Loading...