Browse Source

Made MVC application running.

pull/81/head
Halil İbrahim Kalkan 9 years ago
parent
commit
ab8481ebfc
  1. 7
      Volo.Abp.sln
  2. 24
      src/AbpDesk/AbpDesk.UI/AppModule.cs
  3. 13
      src/AbpDesk/AbpDesk.UI/Controllers/HomeController.cs
  4. 29
      src/AbpDesk/AbpDesk.UI/Controllers/TicketsController.cs
  5. 10
      src/AbpDesk/AbpDesk.UI/Models/Tickets/IndexViewModel.cs
  6. 2
      src/AbpDesk/AbpDesk.UI/Properties/launchSettings.json
  7. 15
      src/AbpDesk/AbpDesk.UI/Views/Tickets/Index.cshtml
  8. 6
      src/AbpDesk/AbpDesk.UI/compilerconfig.json
  9. 49
      src/AbpDesk/AbpDesk.UI/compilerconfig.json.defaults
  10. 12
      src/AbpDesk/AbpDesk.UI/project.json
  11. 5
      src/AbpDesk/AbpDesk.UI/wwwroot/global-styles.css
  12. 1
      src/AbpDesk/AbpDesk.UI/wwwroot/global-styles.min.css
  13. 8
      src/AbpDesk/AbpDesk.UI/wwwroot/global-styles.scss
  14. 19
      src/Volo.Abp.AspNetCore.Mvc/Properties/AssemblyInfo.cs
  15. 20
      src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.xproj
  16. 16
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreModule.cs
  17. 9
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs
  18. 15
      src/Volo.Abp.AspNetCore.Mvc/project.json

7
Volo.Abp.sln

@ -64,6 +64,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AbpDesk.EntityFrameworkCore
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AbpDesk.ConsoleDemo", "src\AbpDesk\AbpDesk.ConsoleDemo\AbpDesk.ConsoleDemo.xproj", "{1A1575D7-E57E-4A40-8113-FD01BB1753D5}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Volo.Abp.AspNetCore.Mvc", "src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.xproj", "{3FB342CA-23B6-4795-91EF-C664527C07B7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -154,6 +156,10 @@ Global
{1A1575D7-E57E-4A40-8113-FD01BB1753D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A1575D7-E57E-4A40-8113-FD01BB1753D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A1575D7-E57E-4A40-8113-FD01BB1753D5}.Release|Any CPU.Build.0 = Release|Any CPU
{3FB342CA-23B6-4795-91EF-C664527C07B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3FB342CA-23B6-4795-91EF-C664527C07B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FB342CA-23B6-4795-91EF-C664527C07B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FB342CA-23B6-4795-91EF-C664527C07B7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -185,5 +191,6 @@ Global
{B6E622CE-0AEE-45DA-81AB-C244196CB583} = {1187F469-0063-4065-9419-A1D956C80145}
{35624E7C-6501-4B42-9AA7-70555666A8B3} = {1187F469-0063-4065-9419-A1D956C80145}
{1A1575D7-E57E-4A40-8113-FD01BB1753D5} = {1187F469-0063-4065-9419-A1D956C80145}
{3FB342CA-23B6-4795-91EF-C664527C07B7} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8}
EndGlobalSection
EndGlobal

24
src/AbpDesk/AbpDesk.UI/AppModule.cs

@ -1,16 +1,24 @@
using Microsoft.AspNetCore.Builder;
using AbpDesk.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore;
using Volo.Abp.AspNetCore.Modularity;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
namespace AbpDesk
{
[DependsOn(typeof(AbpAspNetCoreModule))]
//TODO: Rename project to AbpDesk.Web.Mvc
[DependsOn(typeof(AbpAspNetCoreMvcModule), typeof(AbpDeskApplicationModule), typeof(AbpDeskEntityFrameworkCoreModule))]
public class AppModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
@ -22,9 +30,13 @@ namespace AbpDesk
app.UseDeveloperExceptionPage();
}
app.Run(async (ctx) =>
app.UseStaticFiles();
app.UseMvc(routes =>
{
await ctx.Response.WriteAsync("Hello World 3!");
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}

13
src/AbpDesk/AbpDesk.UI/Controllers/HomeController.cs

@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
namespace AbpDesk.Controllers
{
public class HomeController : AbpController
{
public IActionResult Index()
{
return RedirectToAction("Index", "Tickets");
}
}
}

29
src/AbpDesk/AbpDesk.UI/Controllers/TicketsController.cs

@ -0,0 +1,29 @@
using AbpDesk.Models.Tickets;
using AbpDesk.Tickets;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
namespace AbpDesk.Controllers
{
public class TicketsController : AbpController
{
private readonly ITicketAppService _ticketAppService;
public TicketsController(ITicketAppService ticketAppService)
{
_ticketAppService = ticketAppService;
}
public IActionResult Index()
{
var result = _ticketAppService.GetAll();
var model = new IndexViewModel
{
Tickets = result.Items
};
return View(model);
}
}
}

10
src/AbpDesk/AbpDesk.UI/Models/Tickets/IndexViewModel.cs

@ -0,0 +1,10 @@
using System.Collections.Generic;
using AbpDesk.Tickets.Dtos;
namespace AbpDesk.Models.Tickets
{
public class IndexViewModel
{
public IReadOnlyList<TicketDto> Tickets { get; set; }
}
}

2
src/AbpDesk/AbpDesk.UI/Properties/launchSettings.json

@ -15,7 +15,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"AspNetCoreDemo": {
"AbpDesk.UI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",

15
src/AbpDesk/AbpDesk.UI/Views/Tickets/Index.cshtml

@ -0,0 +1,15 @@
@model AbpDesk.Models.Tickets.IndexViewModel
<link rel="stylesheet" type="text/css" href="~/global-styles.css"/>
<h2>Tickets</h2>
<ul class="ticket-list">
@foreach (var ticket in Model.Tickets)
{
<li data-entity-id="@ticket.Id">
<h3>@ticket.Title</h3>
<p>@ticket.Body</p>
</li>
}
</ul>

6
src/AbpDesk/AbpDesk.UI/compilerconfig.json

@ -0,0 +1,6 @@
[
{
"outputFile": "wwwroot/global-styles.css",
"inputFile": "wwwroot/global-styles.scss"
}
]

49
src/AbpDesk/AbpDesk.UI/compilerconfig.json.defaults

@ -0,0 +1,49 @@
{
"compilers": {
"less": {
"autoPrefix": "",
"cssComb": "none",
"ieCompat": true,
"strictMath": false,
"strictUnits": false,
"relativeUrls": true,
"rootPath": "",
"sourceMapRoot": "",
"sourceMapBasePath": "",
"sourceMap": false
},
"sass": {
"includePath": "",
"indentType": "space",
"indentWidth": 2,
"outputStyle": "nested",
"Precision": 5,
"relativeUrls": true,
"sourceMapRoot": "",
"sourceMap": false
},
"stylus": {
"sourceMap": false
},
"babel": {
"sourceMap": false
},
"coffeescript": {
"bare": false,
"runtimeMode": "node",
"sourceMap": false
}
},
"minifiers": {
"css": {
"enabled": true,
"termSemicolons": true,
"gzip": false
},
"javascript": {
"enabled": true,
"termSemicolons": true,
"gzip": false
}
}
}

12
src/AbpDesk/AbpDesk.UI/project.json

@ -8,19 +8,27 @@
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Volo.Abp.AspNetCore": "1.0.0-*",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"AbpDesk.Application.Contracts": "1.0.0-*",
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.1.0-preview4-final"
},
"Microsoft.AspNetCore.Razor.Tools": {
"type": "build",
"version": "1.1.0-preview4-final"
},
"Volo.Abp.AspNetCore.Mvc": "1.0.0-*",
"AbpDesk.EntityFrameworkCore": "1.0.0-*",
"AbpDesk.Application": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview4-final"
},
"frameworks": {

5
src/AbpDesk/AbpDesk.UI/wwwroot/global-styles.css

@ -0,0 +1,5 @@
ul.ticket-list {
list-style: none; }
ul.ticket-list li {
border-bottom: 1px solid #d0d0d0; }

1
src/AbpDesk/AbpDesk.UI/wwwroot/global-styles.min.css

@ -0,0 +1 @@
ul.ticket-list{list-style:none;}ul.ticket-list li{border-bottom:1px solid #d0d0d0;}

8
src/AbpDesk/AbpDesk.UI/wwwroot/global-styles.scss

@ -0,0 +1,8 @@
ul.ticket-list {
list-style: none;
li {
border-bottom: 1px solid #d0d0d0;
}
}

19
src/Volo.Abp.AspNetCore.Mvc/Properties/AssemblyInfo.cs

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Volo.Abp.AspNetCore.Mvc")]
[assembly: AssemblyTrademark("")]
// 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)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3fb342ca-23b6-4795-91ef-c664527c07b7")]

20
src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.xproj

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>3fb342ca-23b6-4795-91ef-c664527c07b7</ProjectGuid>
<RootNamespace>
</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

16
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreModule.cs

@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc
{
[DependsOn(typeof(AbpAspNetCoreModule))]
public class AbpAspNetCoreMvcModule : IAbpModule
{
public void ConfigureServices(IServiceCollection services)
{
services.AddObjectAccessor<IApplicationBuilder>();
services.AddAssemblyOf<AbpAspNetCoreMvcModule>();
}
}
}

9
src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs

@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.AspNetCore.Mvc
{
public abstract class AbpController : Controller
{
}
}

15
src/Volo.Abp.AspNetCore.Mvc/project.json

@ -0,0 +1,15 @@
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.1",
"Volo.Abp.AspNetCore": "1.0.0-*",
"Microsoft.AspNetCore.Mvc": "1.1.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}
Loading…
Cancel
Save