Commit f2836c7d48dbb5e9e17f70d128e6014a58e0b35f
1 parent
236ec4d5
Update
Showing
3 changed files
with
25 additions
and
18 deletions
Show diff stats
src/Maps/Controllers/BusStopController.cs
@@ -92,8 +92,15 @@ namespace Maps.Controllers | @@ -92,8 +92,15 @@ namespace Maps.Controllers | ||
92 | } | 92 | } |
93 | 93 | ||
94 | [HttpPost] | 94 | [HttpPost] |
95 | - public IActionResult Update(int id, BusStopEditDsF data){ | ||
96 | - return Ok(data); | 95 | + public async Task<IActionResult> Update(int id, BusStopEditDsF data){ |
96 | + if (ModelState.IsValid) | ||
97 | + { | ||
98 | + await _busStopDs.SaveAsync(data,id); | ||
99 | + return Ok(); | ||
100 | + } else { | ||
101 | + return NotFound(); | ||
102 | + } | ||
103 | + | ||
97 | } | 104 | } |
98 | 105 | ||
99 | // POST: BusStop/Create | 106 | // POST: BusStop/Create |
src/MapsDb/DataService/BusStopDs.cs
@@ -37,25 +37,25 @@ namespace MapsDb.DataService | @@ -37,25 +37,25 @@ namespace MapsDb.DataService | ||
37 | }).ToList(); | 37 | }).ToList(); |
38 | } | 38 | } |
39 | 39 | ||
40 | - public Task SaveAsync(BusStopEditDsM busStop, int? id = null){ | 40 | + public Task SaveAsync(BusStopEditDsF busStop, int? id = null){ |
41 | return Task.Factory.StartNew(()=> { Save(busStop, id); }); | 41 | return Task.Factory.StartNew(()=> { Save(busStop, id); }); |
42 | } | 42 | } |
43 | - private void Save(BusStopEditDsM busStop, int? id) | 43 | + private void Save(BusStopEditDsF busStop, int? id) |
44 | { | 44 | { |
45 | BusStop Bs = new BusStop{ | 45 | BusStop Bs = new BusStop{ |
46 | - RoadId = busStop.RoadId, | ||
47 | - RegionId = busStop.RegionId, | ||
48 | - SettlementId = busStop.SettlementId, | ||
49 | - LocationLeft = busStop.LocationLeft, | ||
50 | - LocationRight = busStop.LocationRight, | ||
51 | - SurfaceTypeId = busStop.SurfaceTypeId, | ||
52 | - AreaStopAvailability = busStop.AreaStopAvailability, | ||
53 | - AreaLandAvailability = busStop.AreaLandAvailability, | ||
54 | - PocketAvailability = busStop.PocketAvailability, | ||
55 | - ToiletAvailability = busStop.ToiletAvailability, | ||
56 | - YearBuild = busStop.YearBuild, | ||
57 | - YearRepair = busStop.YearRepair, | ||
58 | - StateCommonId = busStop.StateCommonId | 46 | + RoadId = busStop.roadId, |
47 | + RegionId = busStop.regionId, | ||
48 | + SettlementId = busStop.settlementId, | ||
49 | + LocationLeft = busStop.locationLeft, | ||
50 | + LocationRight = busStop.locationRight, | ||
51 | + SurfaceTypeId = busStop.surfaceTypeId, | ||
52 | + AreaStopAvailability = busStop.areaStopAvailability, | ||
53 | + AreaLandAvailability = busStop.areaLandAvailability, | ||
54 | + PocketAvailability = busStop.pocketAvailability, | ||
55 | + ToiletAvailability = busStop.toiletAvailability, | ||
56 | + YearBuild = busStop.yearBuild, | ||
57 | + YearRepair = busStop.yearRepair, | ||
58 | + StateCommonId = busStop.stateCommonId | ||
59 | }; | 59 | }; |
60 | var busStopFromDb = _context.BusStop.SingleOrDefault(x => x.BusStopId == id); | 60 | var busStopFromDb = _context.BusStop.SingleOrDefault(x => x.BusStopId == id); |
61 | if(busStopFromDb != null) | 61 | if(busStopFromDb != null) |
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(BusStopEditDsM busStop, int? id = null); | 10 | + Task 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 | } |