Commit cf566d89b58bfae4988f3d0cea584bdbd9253aad
1 parent
b9b3b8dd
add edit Vm
Showing
2 changed files
with
32 additions
and
20 deletions
Show diff stats
src/Maps/Controllers/BusStopController.cs
... | ... | @@ -83,26 +83,26 @@ namespace Maps.Controllers |
83 | 83 | return Json(vm); |
84 | 84 | } |
85 | 85 | |
86 | - // // POST: BusStop/Create | |
87 | - // // To protect from overposting attacks, please enable the specific properties you want to bind to, for | |
88 | - // // more details see http://go.microsoft.com/fwlink/?LinkId=317598. | |
89 | - // [HttpPost] | |
90 | - // [ValidateAntiForgeryToken] | |
91 | - // public async Task<IActionResult> Create([Bind("BusStopId,AreaLandAvailability,AreaStopAvailability,BalanceCost,BusStationCardId,CrossSectionNumber,DateActual,LocationLeft,LocationRight,PocketAvailability,Position,RegionId,RepairCertificate,RoadId,SettlementId,StateCommonId,SurfaceTypeId,ToiletAvailability,YearBuild,YearRepair")] BusStop busStop) | |
92 | - // { | |
93 | - // if (ModelState.IsValid) | |
94 | - // { | |
95 | - // _context.Add(busStop); | |
96 | - // await _context.SaveChangesAsync(); | |
97 | - // return RedirectToAction("Index"); | |
98 | - // } | |
99 | - // ViewData["RegionId"] = new SelectList(_context.Region, "RegionId", "RegionId", busStop.RegionId); | |
100 | - // ViewData["RoadId"] = new SelectList(_context.Road, "RoadId", "RoadId", busStop.RoadId); | |
101 | - // ViewData["SettlementId"] = new SelectList(_context.Settlement, "SettlementId", "Name", busStop.SettlementId); | |
102 | - // ViewData["StateCommonId"] = new SelectList(_context.StateCommon, "StateCommonId", "StateCommonId", busStop.StateCommonId); | |
103 | - // ViewData["SurfaceTypeId"] = new SelectList(_context.SurfaceType, "SurfaceTypeId", "SurfaceTypeId", busStop.SurfaceTypeId); | |
104 | - // return View(busStop); | |
105 | - // } | |
86 | + // POST: BusStop/Create | |
87 | + // To protect from overposting attacks, please enable the specific properties you want to bind to, for | |
88 | + // more details see http://go.microsoft.com/fwlink/?LinkId=317598. | |
89 | + [HttpPost] | |
90 | + [ValidateAntiForgeryToken] | |
91 | + public async Task<IActionResult> Create( busStop) | |
92 | + { | |
93 | + if (ModelState.IsValid) | |
94 | + { | |
95 | + _context.Add(busStop); | |
96 | + await _context.SaveChangesAsync(); | |
97 | + return RedirectToAction("Index"); | |
98 | + } | |
99 | + ViewData["RegionId"] = new SelectList(_context.Region, "RegionId", "RegionId", busStop.RegionId); | |
100 | + ViewData["RoadId"] = new SelectList(_context.Road, "RoadId", "RoadId", busStop.RoadId); | |
101 | + ViewData["SettlementId"] = new SelectList(_context.Settlement, "SettlementId", "Name", busStop.SettlementId); | |
102 | + ViewData["StateCommonId"] = new SelectList(_context.StateCommon, "StateCommonId", "StateCommonId", busStop.StateCommonId); | |
103 | + ViewData["SurfaceTypeId"] = new SelectList(_context.SurfaceType, "SurfaceTypeId", "SurfaceTypeId", busStop.SurfaceTypeId); | |
104 | + return View(busStop); | |
105 | + } | |
106 | 106 | |
107 | 107 | // // GET: BusStop/Edit/5 |
108 | 108 | // public async Task<IActionResult> Edit(int? id) | ... | ... |
1 | +namespace MapsModels.DsModels | |
2 | +{ | |
3 | + public class BusStopListDsM | |
4 | + { | |
5 | + public string Road { get; set; } | |
6 | + public string Region { get; set; } | |
7 | + public string Settlement { get; set; } | |
8 | + public double? LocationLeft { get; set; } | |
9 | + public double? LocationRight { get; set; } | |
10 | + public string StateCommon { get; set; } | |
11 | + } | |
12 | +} | |
0 | 13 | \ No newline at end of file | ... | ... |