Commit 7230fa316121442bb67d9e5a63aae4a0ce8bb69b
1 parent
1a6c8f64
Fixes
Showing
3 changed files
with
9 additions
and
8 deletions
Show diff stats
src/Maps/Controllers/BusStopController.cs
@@ -88,14 +88,14 @@ namespace Maps.Controllers | @@ -88,14 +88,14 @@ namespace Maps.Controllers | ||
88 | [HttpPost] | 88 | [HttpPost] |
89 | public async Task<IActionResult> Create([FromBody] BusStopEditDsF data) | 89 | public async Task<IActionResult> Create([FromBody] BusStopEditDsF data) |
90 | { | 90 | { |
91 | - await _busStopDs.SaveAsync(data); | ||
92 | - return Ok(data); | 91 | + var result = await _busStopDs.SaveAsync(data); |
92 | + return Json(result); | ||
93 | } | 93 | } |
94 | 94 | ||
95 | [HttpPost] | 95 | [HttpPost] |
96 | public async Task<IActionResult> Update(int id, [FromBody] BusStopEditDsF data){ | 96 | public async Task<IActionResult> Update(int id, [FromBody] BusStopEditDsF data){ |
97 | await _busStopDs.SaveAsync(data,id); | 97 | await _busStopDs.SaveAsync(data,id); |
98 | - return Ok(); | 98 | + return Json(String.Empty); |
99 | } | 99 | } |
100 | 100 | ||
101 | // POST: BusStop/Create | 101 | // POST: BusStop/Create |
src/MapsDb/DataService/BusStopDs.cs
@@ -34,13 +34,13 @@ namespace MapsDb.DataService | @@ -34,13 +34,13 @@ namespace MapsDb.DataService | ||
34 | YearBuild = busStop.YearBuild, | 34 | YearBuild = busStop.YearBuild, |
35 | YearRepair = busStop.YearRepair, | 35 | YearRepair = busStop.YearRepair, |
36 | StateCommonId = busStop.StateCommonId | 36 | StateCommonId = busStop.StateCommonId |
37 | - }).ToList(); | 37 | + }).OrderByDescending(BusStop => BusStop.BusStopId).ToList(); |
38 | } | 38 | } |
39 | 39 | ||
40 | - public Task SaveAsync(BusStopEditDsF busStop, int? id = null){ | ||
41 | - return Task.Factory.StartNew(()=> { Save(busStop, id); }); | 40 | + public Task<BusStop> SaveAsync(BusStopEditDsF busStop, int? id = null){ |
41 | + return Task.Factory.StartNew(()=> { return Save(busStop, id); }); | ||
42 | } | 42 | } |
43 | - private async void Save(BusStopEditDsF busStop, int? id) | 43 | + private BusStop Save(BusStopEditDsF busStop, int? id) |
44 | { | 44 | { |
45 | BusStop Bs = new BusStop{ | 45 | BusStop Bs = new BusStop{ |
46 | RoadId = busStop.roadId, | 46 | RoadId = busStop.roadId, |
@@ -79,6 +79,7 @@ namespace MapsDb.DataService | @@ -79,6 +79,7 @@ namespace MapsDb.DataService | ||
79 | _context.BusStop.Add(Bs); | 79 | _context.BusStop.Add(Bs); |
80 | } | 80 | } |
81 | _context.SaveChanges(); | 81 | _context.SaveChanges(); |
82 | + return Bs; | ||
82 | } | 83 | } |
83 | public Task<BusStopDetailsDsM> FindOneDetailsAsync(int Id){ | 84 | public Task<BusStopDetailsDsM> FindOneDetailsAsync(int Id){ |
84 | return Task.Factory.StartNew(()=> { return FindOneDetails(Id); }); | 85 | return Task.Factory.StartNew(()=> { return FindOneDetails(Id); }); |
src/MapsDb/Interfaces/IBusStopDs.cs
@@ -7,7 +7,7 @@ namespace MapsDb.Interfaces | @@ -7,7 +7,7 @@ namespace MapsDb.Interfaces | ||
7 | public interface IBusStopDs | 7 | public interface IBusStopDs |
8 | { | 8 | { |
9 | Task<IList<BusStopEditDsM>> GetIndexListAsync(); | 9 | Task<IList<BusStopEditDsM>> GetIndexListAsync(); |
10 | - Task SaveAsync(BusStopEditDsF busStop, int? id = null); | 10 | + Task<BusStop> SaveAsync(BusStopEditDsF busStop, int? id = null); |
11 | Task<BusStopDetailsDsM> FindOneDetailsAsync(int Id); | 11 | Task<BusStopDetailsDsM> FindOneDetailsAsync(int Id); |
12 | Task<int> DeleteAsync(int? Id); | 12 | Task<int> DeleteAsync(int? Id); |
13 | } | 13 | } |