f89dc177
Administrator
add upper case in...
|
1
2
3
4
5
6
7
8
9
10
11
|
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using MapsDb;
using MapsDb.Interfaces;
using MapsDb.DataService;
using MapsModels.ViewModels;
using MapsModels.DsModels;
using System;
|
24f8b1af
Administrator
add RoadSurface
|
12
|
|
f89dc177
Administrator
add upper case in...
|
13
14
15
16
17
18
19
20
21
|
namespace Maps.Controllers
{
public class RoadSurfaceController : Controller
{
private readonly IRoadDs _roadDs;
private readonly IRegionDs _regionDs;
private readonly ISurfaceTypeDs _surfaceTypeDs;
private readonly IStateCommonDs _stateCommonDs;
private readonly IRoadSurfaceDs _roadSurfaceDs;
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
22
23
24
25
26
27
28
29
30
31
32
|
private readonly IRoadDirectionDs _roadDirectionDs;
private readonly ISurfaceTreatmentDs _surfaceTreatmentDs;
public RoadSurfaceController(
IRoadSurfaceDs RoadSurfaceDs,
IStateCommonDs StateCommonDs,
IRoadDs RoadDs,
IRegionDs RegionDs,
ISurfaceTypeDs SurfaceTypeDs,
ISurfaceTreatmentDs SurfaceTreatmentDs,
IRoadDirectionDs RoadDirectionDs
)
|
f89dc177
Administrator
add upper case in...
|
33
34
35
36
37
|
{
_roadDs = RoadDs;
_surfaceTypeDs = SurfaceTypeDs;
_regionDs = RegionDs;
_stateCommonDs = StateCommonDs;
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
38
39
40
|
_roadSurfaceDs = RoadSurfaceDs;
_surfaceTreatmentDs = SurfaceTreatmentDs;
_roadDirectionDs = RoadDirectionDs;
|
f89dc177
Administrator
add upper case in...
|
41
|
}
|
24f8b1af
Administrator
add RoadSurface
|
42
|
|
f89dc177
Administrator
add upper case in...
|
43
44
45
46
|
// GET: BusStop
[HttpGet]
public async Task<IActionResult> Index([FromQuery] PaginationDsM data)
{
|
24f8b1af
Administrator
add RoadSurface
|
47
|
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
48
|
try
|
f89dc177
Administrator
add upper case in...
|
49
|
{
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
50
|
var Data = await _roadSurfaceDs.GetIndexListAsync(data);
|
24f8b1af
Administrator
add RoadSurface
|
51
|
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
RoadSurfaceListVm vm = new RoadSurfaceListVm
{
RoadSurfaceEditDsM = Data.ToList()
};
return Json(vm);
}
catch (NullReferenceException)
{
Response.StatusCode = 400;
return Json("There is no field with name " + data.sort);
}
catch (Exception)
{
return NotFound();
}
|
f89dc177
Administrator
add upper case in...
|
68
|
}
|
24f8b1af
Administrator
add RoadSurface
|
69
|
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
[HttpGet]
public async Task<IActionResult> Directory(){
var Road = await _roadDs.GetSelectListAsync();
var Region = await _regionDs.GetSelectListAsync();
var SurfaceType = await _surfaceTypeDs.GetSelectListAsync();
var StateCommon = await _stateCommonDs.GetSelectListAsync();
var SurfaceTreatment = await _surfaceTreatmentDs.GetSelectListAsync();
var RoadDirection = await _roadDirectionDs.GetSelectListAsync();
CatalogListVm vm = new CatalogListVm
{
RoadSelectListDsM = Road.ToList(),
RegionSelectListDsM = Region.ToList(),
SurfaceTypeSelectListDsM = SurfaceType.ToList(),
StateCommonSelectListDsM = StateCommon.ToList(),
SurfaceTreatmentSelectListDsM = SurfaceTreatment.ToList(),
RoadDirectionSelectListDsM = RoadDirection.ToList()
};
return Json(vm);
}
|
24f8b1af
Administrator
add RoadSurface
|
90
91
|
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
92
93
94
95
96
97
|
[HttpPost]
public async Task<IActionResult> Create([FromBody] RoadSurfaceEditDsM data)
{
var result = await _roadSurfaceDs.CreateAsync(data);
return Json(result);
}
|
24f8b1af
Administrator
add RoadSurface
|
98
|
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
99
100
101
102
103
|
[HttpPost]
public async Task<IActionResult> Update(int id, [FromBody] RoadSurfaceEditDsM data){
await _roadSurfaceDs.UpdateAsync(data,id);
return Json(String.Empty);
}
|
24f8b1af
Administrator
add RoadSurface
|
104
105
|
|
ddeb0c63
Administrator
add RoadSurfaceCo...
|
106
107
108
109
110
111
112
113
114
115
116
117
118
|
[HttpDelete]
public async Task<IActionResult> Delete(int id)
{
try
{
int data = await _roadSurfaceDs.DeleteAsync(id);
return Json(data);
}
catch (ArgumentNullException )
{
return NotFound();
}
}
|
f89dc177
Administrator
add upper case in...
|
119
120
|
}
}
|