Skip to content

Commit 080ad15

Browse files
FabianGosebrinkFabianGosebrink
authored andcommitted
Updated to .NET Core RC2
1 parent 68a6ace commit 080ad15

File tree

19 files changed

+175
-124
lines changed

19 files changed

+175
-124
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24720.0
4+
VisualStudioVersion = 14.0.25123.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F7E300EF-0B6D-46B2-8570-B1FA8A43FC11}"
77
EndProject
@@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1010
global.json = global.json
1111
EndProjectSection
1212
EndProject
13-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SampleWebApiMVC6", "src\SampleWebApiMVC6\SampleWebApiMVC6.xproj", "{34EBD18E-514B-4226-9069-3F3B0517B359}"
13+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SampleWebApiAspNetCore", "src\SampleWebApiAspNetCore\SampleWebApiAspNetCore.xproj", "{34EBD18E-514B-4226-9069-3F3B0517B359}"
1414
EndProject
1515
Global
1616
GlobalSection(SolutionConfigurationPlatforms) = preSolution

global.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"projects": [ "src", "test" ],
3-
"sdk": {
4-
"version": "1.0.0-rc1-update1"
5-
}
2+
"projects": [ "src", "test" ],
3+
"sdk": {
4+
"version": "1.0.0-preview1-002702"
5+
}
66
}

src/SampleWebApiMVC6/Controllers/HouseController.cs renamed to src/SampleWebApiAspNetCore/Controllers/HouseController.cs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
using System;
2-
using System.Linq;
3-
using Microsoft.AspNet.Mvc;
4-
using Microsoft.AspNet.Mvc.ModelBinding;
5-
using SampleWebApiMVC6.Models;
6-
using SampleWebApiMVC6.Services;
7-
using System.Collections.Generic;
8-
using Microsoft.AspNet.JsonPatch;
9-
10-
namespace SampleWebApiMVC6.Controllers
1+
using System.Linq;
2+
using Microsoft.AspNetCore.JsonPatch;
3+
using Microsoft.AspNetCore.Mvc;
4+
using SampleWebApiAspNetCore.Models;
5+
using SampleWebApiAspNetCore.Services;
6+
7+
namespace SampleWebApiAspNetCore.Controllers
118
{
129
[Route("api/[controller]")]
1310
public class HouseController : Controller
@@ -32,7 +29,7 @@ public IActionResult GetSingle(int id)
3229

3330
if (houseEntity == null)
3431
{
35-
return new HttpNotFoundResult();
32+
return new NotFoundResult();
3633
}
3734

3835
return new JsonResult(_houseMapper.MapToDto(houseEntity));
@@ -43,12 +40,12 @@ public IActionResult Patch(int id, [FromBody] JsonPatchDocument<HouseEntity> hou
4340
{
4441
if (housePatchDocument == null)
4542
{
46-
return HttpBadRequest();
43+
return BadRequest();
4744
}
4845

4946
if (!ModelState.IsValid)
5047
{
51-
return HttpBadRequest(ModelState);
48+
return BadRequest(ModelState);
5249
}
5350

5451
HouseEntity houseEntity = Singleton.Instance.Houses.FirstOrDefault(x => x.Id == id);
@@ -57,7 +54,7 @@ public IActionResult Patch(int id, [FromBody] JsonPatchDocument<HouseEntity> hou
5754

5855
if (!ModelState.IsValid)
5956
{
60-
return HttpBadRequest(ModelState);
57+
return BadRequest(ModelState);
6158
}
6259

6360
int index = Singleton.Instance.Houses.FindIndex(x => x.Id == id);
@@ -76,7 +73,7 @@ public IActionResult Create([FromBody] HouseDto houseDto)
7673

7774
if (!ModelState.IsValid)
7875
{
79-
return HttpBadRequest(ModelState);
76+
return BadRequest(ModelState);
8077
}
8178

8279
HouseEntity houseEntity = _houseMapper.MapToEntity(houseDto);
@@ -96,14 +93,14 @@ public IActionResult Update(int id, [FromBody] HouseDto houseDto)
9693

9794
if (!ModelState.IsValid)
9895
{
99-
return HttpBadRequest(ModelState);
96+
return BadRequest(ModelState);
10097
}
10198

10299
HouseEntity houseEntityToUpdate = Singleton.Instance.Houses.FirstOrDefault(x => x.Id == id);
103100

104101
if (houseEntityToUpdate == null)
105102
{
106-
return new HttpNotFoundResult();
103+
return new NotFoundResult();
107104
}
108105

109106
houseEntityToUpdate.ZipCode = houseDto.ZipCode;
@@ -122,7 +119,7 @@ public IActionResult Delete(int id)
122119

123120
if (houseEntityToDelete == null)
124121
{
125-
return new HttpNotFoundResult();
122+
return new NotFoundResult();
126123
}
127124

128125
Singleton.Instance.Houses.Remove(houseEntityToDelete);

src/SampleWebApiMVC6/Models/HouseDto.cs renamed to src/SampleWebApiAspNetCore/Models/HouseDto.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.ComponentModel.DataAnnotations;
22

3-
namespace SampleWebApiMVC6.Models
3+
namespace SampleWebApiAspNetCore.Models
44
{
55
public class HouseDto
66
{

src/SampleWebApiMVC6/Models/HouseEntity.cs renamed to src/SampleWebApiAspNetCore/Models/HouseEntity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SampleWebApiMVC6.Models
1+
namespace SampleWebApiAspNetCore.Models
22
{
33
public class HouseEntity
44
{
File renamed without changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:29435/",
7+
"sslPort": 0
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"WebApplication7": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"launchUrl": "http://localhost:5000",
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
}
25+
}
26+
}
27+
}

src/SampleWebApiMVC6/SampleWebApiMVC6.xproj renamed to src/SampleWebApiAspNetCore/SampleWebApiAspNetCore.xproj

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
66
</PropertyGroup>
7-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
7+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
88
<PropertyGroup Label="Globals">
99
<ProjectGuid>34ebd18e-514b-4226-9069-3f3b0517b359</ProjectGuid>
10-
<RootNamespace>SampleWebApiMVC6</RootNamespace>
11-
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12-
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
10+
<RootNamespace>SampleWebApiAspNetCore</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
13+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1314
</PropertyGroup>
1415
<PropertyGroup>
1516
<SchemaVersion>2.0</SchemaVersion>
1617
</PropertyGroup>
17-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
18-
</Project>
18+
<ItemGroup>
19+
<DnxInvisibleContent Include="bower.json" />
20+
<DnxInvisibleContent Include=".bowerrc" />
21+
<DnxInvisibleContent Include="package.json" />
22+
<DnxInvisibleContent Include=".npmrc" />
23+
</ItemGroup>
24+
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
25+
</Project>

src/SampleWebApiMVC6/Services/HouseMapper.cs renamed to src/SampleWebApiAspNetCore/Services/HouseMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Linq;
2-
using SampleWebApiMVC6.Models;
2+
using SampleWebApiAspNetCore.Models;
33

4-
namespace SampleWebApiMVC6.Services
4+
namespace SampleWebApiAspNetCore.Services
55
{
66
public class HouseMapper : IHouseMapper
77
{

src/SampleWebApiMVC6/Services/IHouseMapper.cs renamed to src/SampleWebApiAspNetCore/Services/IHouseMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using SampleWebApiMVC6.Models;
1+
using SampleWebApiAspNetCore.Models;
22

3-
namespace SampleWebApiMVC6.Services
3+
namespace SampleWebApiAspNetCore.Services
44
{
55
public interface IHouseMapper
66
{

0 commit comments

Comments
 (0)