Skip to content

Commit 223381c

Browse files
Merge pull request #74 from DuckTieCorpMember/25.1.3+
Convert the old project to new version
2 parents 291b00a + 91aa6ed commit 223381c

File tree

97 files changed

+19194
-16983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+19194
-16983
lines changed

ASP.NET Core/ASP.NET Core.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
</Target>
2121

2222
<ItemGroup>
23-
<PackageReference Include="DevExtreme.AspNet.Core" Version="25.1.*" />
23+
<PackageReference Include="DevExtreme.AspNet.Core" Version="25.1.3" />
24+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
2425
</ItemGroup>
2526

2627
</Project>

ASP.NET Core/Controllers/SampleDataController.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
using System.Linq;
44
using System.Net;
55
using System.Net.Http;
6+
using System.Xml.Linq;
7+
using ASP.NET_Core.Models;
68
using ASP_NET_Core.Models;
79
using DevExtreme.AspNet.Data;
810
using DevExtreme.AspNet.Mvc;
911
using Microsoft.AspNetCore.Mvc;
12+
using Newtonsoft.Json;
13+
using ASP_NET_Core.Extensions;
1014

1115
namespace ASP_NET_Core.Controllers {
1216

@@ -15,8 +19,36 @@ public class SampleDataController : Controller {
1519

1620
[HttpGet]
1721
public object Get(DataSourceLoadOptions loadOptions) {
18-
return DataSourceLoader.Load(SampleData.Orders, loadOptions);
22+
return DataSourceLoader.Load(EmployeeStore.Employees, loadOptions);
1923
}
24+
[HttpPost]
25+
public IActionResult Add(string values) {
26+
var newEmployee = new Employee();
27+
JsonConvert.PopulateObject(values, newEmployee);
2028

29+
if (!TryValidateModel(newEmployee))
30+
return BadRequest(ModelState.GetFullErrorMessage());
31+
32+
EmployeeStore.Employees.Add(newEmployee);
33+
34+
return Ok();
35+
}
36+
37+
[HttpPut]
38+
public IActionResult Update(int key, string values) {
39+
var employee = EmployeeStore.Employees.First(a => a.ID == key);
40+
JsonConvert.PopulateObject(values, employee);
41+
42+
if (!TryValidateModel(employee))
43+
return BadRequest(ModelState.GetFullErrorMessage());
44+
45+
return Ok();
46+
}
47+
48+
[HttpDelete]
49+
public void Delete(int key) {
50+
var employee = EmployeeStore.Employees.First(a => a.ID == key);
51+
EmployeeStore.Employees.Remove(employee);
52+
}
2153
}
2254
}

ASP.NET Core/Controllers/orig_HomeController.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

ASP.NET Core/Controllers/orig_SampleDataController.cs

Lines changed: 0 additions & 54 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)