diff --git a/Bootstrap.Client/App_Start/RouteConfig.cs b/Bootstrap.Client/App_Start/RouteConfig.cs new file mode 100644 index 00000000..75f0e39b --- /dev/null +++ b/Bootstrap.Client/App_Start/RouteConfig.cs @@ -0,0 +1,19 @@ +using System.Web.Mvc; +using System.Web.Routing; + +namespace Bootstrap.Client +{ + public class RouteConfig + { + public static void RegisterRoutes(RouteCollection routes) + { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } + ); + } + } +} diff --git a/Bootstrap.Client/App_Start/WebApiConfig.cs b/Bootstrap.Client/App_Start/WebApiConfig.cs new file mode 100644 index 00000000..4ed179ca --- /dev/null +++ b/Bootstrap.Client/App_Start/WebApiConfig.cs @@ -0,0 +1,21 @@ +using System.Web.Http; + +namespace Bootstrap.Client +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + // Web API configuration and services + + // Web API routes + config.MapHttpAttributeRoutes(); + + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } + } +} diff --git a/Bootstrap.Client/Bootstrap.Client.csproj b/Bootstrap.Client/Bootstrap.Client.csproj new file mode 100644 index 00000000..d6044d8d --- /dev/null +++ b/Bootstrap.Client/Bootstrap.Client.csproj @@ -0,0 +1,171 @@ + + + + + + + Debug + AnyCPU + + + 2.0 + {6B261B2C-9E70-467C-BE76-13C0E280A683} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Bootstrap.Client + Bootstrap.Client + v4.5 + true + + + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll + + + ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.dll + + + ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Deployment.dll + + + ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Razor.dll + + + ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Helpers.dll + + + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll + + + ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll + + + + + + + + + + + + + + + Global.asax + + + + + + + + Web.config + + + Web.config + + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 53737 + / + http://localhost:3600 + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/Bootstrap.Client/Controllers/HomeController.cs b/Bootstrap.Client/Controllers/HomeController.cs new file mode 100644 index 00000000..826b9d4a --- /dev/null +++ b/Bootstrap.Client/Controllers/HomeController.cs @@ -0,0 +1,13 @@ +using System.Web.Mvc; + +namespace Bootstrap.Client.Controllers +{ + public class HomeController : Controller + { + // GET: Home + public ActionResult Index() + { + return View(); + } + } +} \ No newline at end of file diff --git a/Bootstrap.Client/Controllers/TestController.cs b/Bootstrap.Client/Controllers/TestController.cs new file mode 100644 index 00000000..ded619ab --- /dev/null +++ b/Bootstrap.Client/Controllers/TestController.cs @@ -0,0 +1,65 @@ +using Bootstrap.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using System.Web.Mvc; + +namespace Bootstrap.Controllers +{ + public class TestController : ApiController + { + // GET api/ + public Dummy Get(int limit, int offset, string name, string price, string sort, string order) + { + var p = new TerminalsModel(); + var ret = new List(); + Random rnd = new Random(); + for (int index = 1; index < 1000; index++) + { + ret.Add(new TerminalsModel() { Id = index.ToString(), Name = string.Format("Argo-{0:D4}", index), Price = index.ToString() }); + } + if (!string.IsNullOrEmpty(name)) ret = ret.Where(n => n.Name.Contains(name)).ToList(); + if (!string.IsNullOrEmpty(price)) ret = ret.Where(n => n.Price.Contains(price)).ToList(); + if (!string.IsNullOrEmpty(sort)) + { + if (sort.Equals("Name")) { ret = order == "desc" ? ret.OrderByDescending(n => n.Name).ToList() : ret.OrderBy(n => n.Name).ToList(); } + if (sort.Equals("Price")) { ret = order == "desc" ? ret.OrderByDescending(n => n.Price).ToList() : ret.OrderBy(n => n.Price).ToList(); } + } + var total = ret.Count; + var rows = ret.Skip(offset).Take(limit).ToList(); + return new Dummy() { total = total, rows = rows }; + } + + public class Dummy + { + } + + // GET api//5 + public string Get(int id) + { + return "value"; + } + + // POST api/ + public string Post([FromBody]string value) + { + return "value"; + } + + // PUT api//5 + public void Put(int id, [FromBody]string value) + { + + } + + [System.Web.Mvc.HttpDelete] + // DELETE api//5 + public void Delete(int id) + { + + } + } +} \ No newline at end of file diff --git a/Bootstrap.Client/Global.asax b/Bootstrap.Client/Global.asax new file mode 100644 index 00000000..c031226e --- /dev/null +++ b/Bootstrap.Client/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="Bootstrap.Client.Global" Language="C#" %> diff --git a/Bootstrap.Client/Global.asax.cs b/Bootstrap.Client/Global.asax.cs new file mode 100644 index 00000000..fda192bc --- /dev/null +++ b/Bootstrap.Client/Global.asax.cs @@ -0,0 +1,19 @@ +using System; +using System.Web; +using System.Web.Http; +using System.Web.Mvc; +using System.Web.Routing; + +namespace Bootstrap.Client +{ + public class Global : HttpApplication + { + void Application_Start(object sender, EventArgs e) + { + // Code that runs on application startup + AreaRegistration.RegisterAllAreas(); + GlobalConfiguration.Configure(WebApiConfig.Register); + RouteConfig.RegisterRoutes(RouteTable.Routes); + } + } +} \ No newline at end of file diff --git a/Bootstrap.Client/Login/Login.html b/Bootstrap.Client/Login/Login.html new file mode 100644 index 00000000..20f9d73d --- /dev/null +++ b/Bootstrap.Client/Login/Login.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Bootstrap.Client/Properties/AssemblyInfo.cs b/Bootstrap.Client/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..019d878b --- /dev/null +++ b/Bootstrap.Client/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Bootstrap Client")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Bootstrap Client Demo")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] +[assembly: CLSCompliant(true)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("D77FF1C6-E112-486F-88C2-C473420AE316")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Bootstrap.Client/Views/Home/Index.cshtml b/Bootstrap.Client/Views/Home/Index.cshtml new file mode 100644 index 00000000..f2572dbc --- /dev/null +++ b/Bootstrap.Client/Views/Home/Index.cshtml @@ -0,0 +1,10 @@ +@{ + ViewBag.Title = "前台测试首页"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} +@section css { +} +@section javascript { +} +
我就是一个测试页面
+
Bottom
\ No newline at end of file diff --git a/Bootstrap.Client/Views/Shared/_Layout.cshtml b/Bootstrap.Client/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..085e13ad --- /dev/null +++ b/Bootstrap.Client/Views/Shared/_Layout.cshtml @@ -0,0 +1,15 @@ + + + + + + + @ViewBag.Title + + @RenderSection("css", false) + + + @RenderBody() + @RenderSection("Javascript", false) + + diff --git a/Bootstrap.Client/Views/web.config b/Bootstrap.Client/Views/web.config new file mode 100644 index 00000000..c377c2f3 --- /dev/null +++ b/Bootstrap.Client/Views/web.config @@ -0,0 +1,42 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bootstrap.Client/Web.Debug.config b/Bootstrap.Client/Web.Debug.config new file mode 100644 index 00000000..24f336cd --- /dev/null +++ b/Bootstrap.Client/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Bootstrap.Client/Web.Release.config b/Bootstrap.Client/Web.Release.config new file mode 100644 index 00000000..a6579812 --- /dev/null +++ b/Bootstrap.Client/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Bootstrap.Client/Web.config b/Bootstrap.Client/Web.config new file mode 100644 index 00000000..dfe4d08e --- /dev/null +++ b/Bootstrap.Client/Web.config @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Bootstrap.Client/packages.config b/Bootstrap.Client/packages.config new file mode 100644 index 00000000..776c2fc0 --- /dev/null +++ b/Bootstrap.Client/packages.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/BootstrapAdmin.sln b/BootstrapAdmin.sln index c8d6e3f8..d2cb8ca8 100644 --- a/BootstrapAdmin.sln +++ b/BootstrapAdmin.sln @@ -29,6 +29,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{5864 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bootstrap.DataAccessTests", "Bootstrap.DataAccessTests\Bootstrap.DataAccessTests.csproj", "{D3A9D339-6E5E-416D-BB71-D3AAE105BD16}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bootstrap.Client", "Bootstrap.Client\Bootstrap.Client.csproj", "{6B261B2C-9E70-467C-BE76-13C0E280A683}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,6 +49,10 @@ Global {D3A9D339-6E5E-416D-BB71-D3AAE105BD16}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3A9D339-6E5E-416D-BB71-D3AAE105BD16}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3A9D339-6E5E-416D-BB71-D3AAE105BD16}.Release|Any CPU.Build.0 = Release|Any CPU + {6B261B2C-9E70-467C-BE76-13C0E280A683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B261B2C-9E70-467C-BE76-13C0E280A683}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B261B2C-9E70-467C-BE76-13C0E280A683}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B261B2C-9E70-467C-BE76-13C0E280A683}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE