Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions ASP.NET Core/Controllers/SampleDataController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,42 @@
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using ASP_NET_Core.Models;
using ASP_NET_Core.Utils;
using DevExtreme.AspNet.Data;
using DevExtreme.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;

namespace ASP_NET_Core.Controllers;
namespace ASP_NET_Core.Controllers {

[Route("api/[controller]")]
public class SampleDataController: Controller {
[Route("api/[controller]/[action]")]
public class SampleDataController : Controller {

[HttpGet]
public object Get(DataSourceLoadOptions loadOptions) {
return DataSourceLoader.Load(SampleData.Orders, loadOptions);
}
[HttpGet]
public object GetSelectBoxItems(DataSourceLoadOptions loadOptions)
{
return DataSourceLoader.Load(SampleData.Items, loadOptions);
}

[HttpGet]
public object Get(DataSourceLoadOptions loadOptions) {

return DataSourceLoader.Load(SampleData.Employees, loadOptions);
}

[HttpPut]
public IActionResult Put(int key, string values)
{
var item = SampleData.Employees.First(e => e.ID == key);

item.PopulateFromJson(values);

if (!TryValidateModel(item))
return BadRequest(ModelState);

return Ok(item);
}

}
}
44 changes: 0 additions & 44 deletions ASP.NET Core/Controllers/orig_SampleDataController.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ASP_NET_Core.Models {
public class Employee {
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime HireDate { get; set; }
public string Address { get; set; }
}
public class Item
{
public string Value { get; set; }

public class Item {
public string Text { get; set; }
public string Value { get; set; }
}
}
Loading
Loading