32912d0b
Administrator
first commit
|
1
2
3
4
5
6
|
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using MapsDb;
|
b9b3b8dd
Administrator
add deteils and c...
|
7
|
using MapsDb.Interfaces;
|
32912d0b
Administrator
first commit
|
8
9
|
using MapsDb.DataService;
using MapsModels.ViewModels;
|
abec55bf
Administrator
Finish busStop mo...
|
10
|
using MapsModels.DsModels;
|
94ffda14
Yarik
Delete action
|
11
12
|
using System;
|
32912d0b
Administrator
first commit
|
13
14
15
16
17
|
namespace Maps.Controllers
{
public class BusStopController : Controller
{
private readonly IBusStopDs _busStopDs;
|
b9b3b8dd
Administrator
add deteils and c...
|
18
19
20
|
private readonly IRoadDs _roadDs;
private readonly ISettlementDs _settlementDs;
private readonly IStateCommonDs _stateCommonDs;
|
41da292f
Administrator
fix d
|
21
|
private readonly IRegionDs _regionDs;
|
b9b3b8dd
Administrator
add deteils and c...
|
22
|
private readonly ISurfaceTypeDs _surfaceTypeDs;
|
32912d0b
Administrator
first commit
|
23
|
|
41da292f
Administrator
fix d
|
24
|
public BusStopController(IBusStopDs BusStopDs, IRoadDs RoadDs, ISettlementDs SettlementDs, IRegionDs RegionDs, IStateCommonDs StateCommonDs, ISurfaceTypeDs SurfaceTypeDs)
|
32912d0b
Administrator
first commit
|
25
|
{
|
b9b3b8dd
Administrator
add deteils and c...
|
26
27
28
29
|
_busStopDs = BusStopDs;
_roadDs = RoadDs;
_settlementDs = SettlementDs;
_stateCommonDs = StateCommonDs;
|
41da292f
Administrator
fix d
|
30
|
_regionDs = RegionDs;
|
b9b3b8dd
Administrator
add deteils and c...
|
31
|
_surfaceTypeDs = SurfaceTypeDs;
|
32912d0b
Administrator
first commit
|
32
33
34
35
|
}
// GET: BusStop
[HttpGet]
|
db607025
Administrator
add pagination
|
36
|
public async Task<IActionResult> Index([FromQuery] PaginationDsM data)
|
32912d0b
Administrator
first commit
|
37
|
{
|
21446fef
Administrator
add marge commit
|
38
|
|
db607025
Administrator
add pagination
|
39
40
41
42
43
44
|
var busStops = await _busStopDs.GetIndexListAsync(data);
BusStopListVm vm = new BusStopListVm
{
BusStopEditDsM = busStops.ToList()
};
|
5414fbd7
Administrator
change ds
|
45
|
|
db607025
Administrator
add pagination
|
46
|
return Json(vm);
|
21446fef
Administrator
add marge commit
|
47
|
|
db607025
Administrator
add pagination
|
48
|
|
5414fbd7
Administrator
change ds
|
49
|
|
5414fbd7
Administrator
change ds
|
50
51
52
53
|
}
[HttpGet]
public async Task<IActionResult> Directory(){
|
2de47257
Administrator
add one ds with a...
|
54
55
56
57
58
|
var SurfaceType = await _surfaceTypeDs.GetSelectListAsync();
var StateCommon = await _stateCommonDs.GetSelectListAsync();
var Settlement = await _settlementDs.GetSelectListAsync();
var Road = await _roadDs.GetSelectListAsync();
var Region = await _regionDs.GetSelectListAsync();
|
32912d0b
Administrator
first commit
|
59
|
|
27918c1f
Administrator
add service object
|
60
|
CatalogListVm vm = new CatalogListVm
|
32912d0b
Administrator
first commit
|
61
|
{
|
2de47257
Administrator
add one ds with a...
|
62
63
64
65
66
|
SurfaceTypeSelectListDsM = SurfaceType.ToList(),
StateCommonSelectListDsM = StateCommon.ToList(),
SettlementSelectListDsM = Settlement.ToList(),
RoadSelectListDsM = Road.ToList(),
RegionSelectListDsM = Region.ToList()
|
32912d0b
Administrator
first commit
|
67
|
};
|
32912d0b
Administrator
first commit
|
68
69
70
|
return Json(vm);
}
|
44582203
Administrator
bag fix
|
71
|
|
7fd789ff
Yarik
Cors
|
72
|
[HttpPost]
|
27918c1f
Administrator
add service object
|
73
|
public async Task<IActionResult> Create([FromBody] BusStopEditDsM data)
|
b9b3b8dd
Administrator
add deteils and c...
|
74
|
{
|
e02ee314
Administrator
add update and cr...
|
75
|
var result = await _busStopDs.CreateAsync(data);
|
7230fa31
Yarik
Fixes
|
76
|
return Json(result);
|
b9b3b8dd
Administrator
add deteils and c...
|
77
|
}
|
44582203
Administrator
bag fix
|
78
|
|
7fd789ff
Yarik
Cors
|
79
|
[HttpPost]
|
27918c1f
Administrator
add service object
|
80
|
public async Task<IActionResult> Update(int id, [FromBody] BusStopEditDsM data){
|
e02ee314
Administrator
add update and cr...
|
81
|
await _busStopDs.UpdateAsync(data,id);
|
7230fa31
Yarik
Fixes
|
82
|
return Json(String.Empty);
|
e4970e8a
Administrator
commit
|
83
|
}
|
a9a5efb8
Administrator
test
|
84
|
|
27918c1f
Administrator
add service object
|
85
|
|
94ffda14
Yarik
Delete action
|
86
|
[HttpDelete]
|
e02ee314
Administrator
add update and cr...
|
87
|
public async Task<IActionResult> Delete(int id)
|
e6477bbf
Administrator
test2
|
88
|
{
|
94ffda14
Yarik
Delete action
|
89
90
|
try
{
|
e6477bbf
Administrator
test2
|
91
92
|
int busStop = await _busStopDs.DeleteAsync(id);
return Json(busStop);
|
94ffda14
Yarik
Delete action
|
93
|
}
|
abec55bf
Administrator
Finish busStop mo...
|
94
|
catch (ArgumentNullException )
|
94ffda14
Yarik
Delete action
|
95
96
97
|
{
return NotFound();
}
|
94ffda14
Yarik
Delete action
|
98
|
}
|
32912d0b
Administrator
first commit
|
99
100
|
}
}
|