Commit e6477bbf8f682fe4ef0afe5f92dd2e12a0e27713
1 parent
a9a5efb8
test2
Showing
1 changed file
with
28 additions
and
28 deletions
Show diff stats
src/Maps/Controllers/BusStopController.cs
@@ -86,44 +86,44 @@ namespace Maps.Controllers | @@ -86,44 +86,44 @@ namespace Maps.Controllers | ||
86 | } | 86 | } |
87 | 87 | ||
88 | 88 | ||
89 | - // POST: BusStop/Create | ||
90 | - // To protect from overposting attacks, please enable the specific properties you want to bind to, for | ||
91 | - // more details see http://go.microsoft.com/fwlink/?LinkId=317598. | ||
92 | - [HttpPost] | ||
93 | - [ValidateAntiForgeryToken] | ||
94 | - public async Task<IActionResult> Create( busStop) | ||
95 | - { | ||
96 | - if (ModelState.IsValid) | ||
97 | - { | ||
98 | - _context.Add(busStop); | ||
99 | - await _context.SaveChangesAsync(); | ||
100 | - return RedirectToAction("Index"); | ||
101 | - } | ||
102 | - ViewData["RegionId"] = new SelectList(_context.Region, "RegionId", "RegionId", busStop.RegionId); | ||
103 | - ViewData["RoadId"] = new SelectList(_context.Road, "RoadId", "RoadId", busStop.RoadId); | ||
104 | - ViewData["SettlementId"] = new SelectList(_context.Settlement, "SettlementId", "Name", busStop.SettlementId); | ||
105 | - ViewData["StateCommonId"] = new SelectList(_context.StateCommon, "StateCommonId", "StateCommonId", busStop.StateCommonId); | ||
106 | - ViewData["SurfaceTypeId"] = new SelectList(_context.SurfaceType, "SurfaceTypeId", "SurfaceTypeId", busStop.SurfaceTypeId); | ||
107 | - return View(busStop); | ||
108 | - } | 89 | + // // POST: BusStop/Create |
90 | + // // To protect from overposting attacks, please enable the specific properties you want to bind to, for | ||
91 | + // // more details see http://go.microsoft.com/fwlink/?LinkId=317598. | ||
92 | + // [HttpPost] | ||
93 | + // [ValidateAntiForgeryToken] | ||
94 | + // public async Task<IActionResult> Create( busStop) | ||
95 | + // { | ||
96 | + // if (ModelState.IsValid) | ||
97 | + // { | ||
98 | + // _context.Add(busStop); | ||
99 | + // await _context.SaveChangesAsync(); | ||
100 | + // return RedirectToAction("Index"); | ||
101 | + // } | ||
102 | + // ViewData["RegionId"] = new SelectList(_context.Region, "RegionId", "RegionId", busStop.RegionId); | ||
103 | + // ViewData["RoadId"] = new SelectList(_context.Road, "RoadId", "RoadId", busStop.RoadId); | ||
104 | + // ViewData["SettlementId"] = new SelectList(_context.Settlement, "SettlementId", "Name", busStop.SettlementId); | ||
105 | + // ViewData["StateCommonId"] = new SelectList(_context.StateCommon, "StateCommonId", "StateCommonId", busStop.StateCommonId); | ||
106 | + // ViewData["SurfaceTypeId"] = new SelectList(_context.SurfaceType, "SurfaceTypeId", "SurfaceTypeId", busStop.SurfaceTypeId); | ||
107 | + // return View(busStop); | ||
108 | + // } | ||
109 | 109 | ||
110 | [HttpDelete] | 110 | [HttpDelete] |
111 | public async Task<IActionResult> Delete(int? id) | 111 | public async Task<IActionResult> Delete(int? id) |
112 | - { | ||
113 | - if (id == null) | ||
114 | - { | ||
115 | - return NotFound(); | ||
116 | - } | ||
117 | - int busStop; | 112 | + { |
118 | try | 113 | try |
119 | { | 114 | { |
120 | - busStop = await _busStopDs.DeleteAsync(id); | 115 | + if (id == null) |
116 | + { | ||
117 | + return NotFound(); | ||
118 | + } | ||
119 | + | ||
120 | + int busStop = await _busStopDs.DeleteAsync(id); | ||
121 | + return Json(busStop); | ||
121 | } | 122 | } |
122 | catch (ArgumentNullException e) | 123 | catch (ArgumentNullException e) |
123 | { | 124 | { |
124 | return NotFound(); | 125 | return NotFound(); |
125 | } | 126 | } |
126 | - return Json(busStop); | ||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 |