Commit f89dc177d513aa39a81b9dd1f486ceea124bf91e

Authored by Administrator
1 parent 24f8b1af

add upper case in sort

src/Maps/Controllers/RoadSurfaceController.cs
1 -// using System.Linq;  
2 -// using System.Threading.Tasks;  
3 -// using Microsoft.AspNetCore.Mvc;  
4 -// using Microsoft.AspNetCore.Mvc.Rendering;  
5 -// using Microsoft.EntityFrameworkCore;  
6 -// using MapsDb;  
7 -// using MapsDb.Interfaces;  
8 -// using MapsDb.DataService;  
9 -// using MapsModels.ViewModels;  
10 -// using MapsModels.DsModels;  
11 -// using System; 1 +using System.Linq;
  2 +using System.Threading.Tasks;
  3 +using Microsoft.AspNetCore.Mvc;
  4 +using Microsoft.AspNetCore.Mvc.Rendering;
  5 +using Microsoft.EntityFrameworkCore;
  6 +using MapsDb;
  7 +using MapsDb.Interfaces;
  8 +using MapsDb.DataService;
  9 +using MapsModels.ViewModels;
  10 +using MapsModels.DsModels;
  11 +using System;
12 12
13 -// namespace Maps.Controllers  
14 -// {  
15 -// public class RoadSurfaceController : Controller  
16 -// {  
17 -// private readonly IRoadDs _roadDs;  
18 -// private readonly IRegionDs _regionDs;  
19 -// private readonly ISurfaceTypeDs _surfaceTypeDs;  
20 -// private readonly IStateCommonDs _stateCommonDs;  
21 -// public RoadSurfaceController(IStateCommonDs StateCommonDs, IRoadDs RoadDs, IRegionDs RegionDs, ISurfaceTypeDs SurfaceTypeDs)  
22 -// {  
23 -  
24 -// _roadDs = RoadDs;  
25 -// _surfaceTypeDs = SurfaceTypeDs;  
26 -// _regionDs = RegionDs;  
27 -// _stateCommonDs = StateCommonDs;  
28 -// } 13 +namespace Maps.Controllers
  14 +{
  15 + public class RoadSurfaceController : Controller
  16 + {
  17 + private readonly IRoadDs _roadDs;
  18 + private readonly IRegionDs _regionDs;
  19 + private readonly ISurfaceTypeDs _surfaceTypeDs;
  20 + private readonly IStateCommonDs _stateCommonDs;
  21 + private readonly IRoadSurfaceDs _roadSurfaceDs;
  22 + public RoadSurfaceController(IRoadSurfaceDs RoadSurfaceDs, IStateCommonDs StateCommonDs, IRoadDs RoadDs, IRegionDs RegionDs, ISurfaceTypeDs SurfaceTypeDs)
  23 + {
  24 + _roadDs = RoadDs;
  25 + _surfaceTypeDs = SurfaceTypeDs;
  26 + _regionDs = RegionDs;
  27 + _stateCommonDs = StateCommonDs;
  28 + _roadSurfaceDs = RoadSurfaceDs;
  29 + }
29 30
30 -// // GET: BusStop  
31 -// [HttpGet]  
32 -// public async Task<IActionResult> Index([FromQuery] PaginationDsM data)  
33 -// {  
34 -// var Data = await _serviceObjectDs.GetIndexListAsync(data); 31 + // GET: BusStop
  32 + [HttpGet]
  33 + public async Task<IActionResult> Index([FromQuery] PaginationDsM data)
  34 + {
  35 + var Data = await _roadSurfaceDs.GetIndexListAsync(data);
35 36
36 -// ServiceObjectListVm vm = new ServiceObjectListVm  
37 -// {  
38 -// ServiceObjectEditDsM = Data.ToList()  
39 -// }; 37 + RoadSurfaceListVm vm = new RoadSurfaceListVm
  38 + {
  39 + RoadSurfaceEditDsM = Data.ToList()
  40 + };
40 41
41 -// return Json(vm);  
42 -// } 42 + return Json(vm);
  43 + }
43 44
44 -// [HttpGet]  
45 -// public async Task<IActionResult> Directory(){  
46 -// var DepartmentAffiliation = await _departmentAffiliationDs.GetSelectListAsync();  
47 -// var Settlement = await _settlementDs.GetSelectListAsync();  
48 -// var Road = await _roadDs.GetSelectListAsync();  
49 -// var Region = await _regionDs.GetSelectListAsync();  
50 -// var ServiceObjectType = await _serviceObjectTypeDs.GetSelectListAsync();  
51 -// CatalogListVm vm = new CatalogListVm  
52 -// {  
53 -// DepartmentAffiliationSelectListDsM = DepartmentAffiliation.ToList(),  
54 -// SettlementSelectListDsM = Settlement.ToList(),  
55 -// ServiceObjectTypeSelectListDsM = ServiceObjectType.ToList(),  
56 -// RoadSelectListDsM = Road.ToList(),  
57 -// RegionSelectListDsM = Region.ToList()  
58 -// };  
59 -// return Json(vm);  
60 -// } 45 + //[HttpGet]
  46 + // public async Task<IActionResult> Directory(){
  47 + // var DepartmentAffiliation = await _departmentAffiliationDs.GetSelectListAsync();
  48 + // var Settlement = await _settlementDs.GetSelectListAsync();
  49 + // var Road = await _roadDs.GetSelectListAsync();
  50 + // var Region = await _regionDs.GetSelectListAsync();
  51 + // var ServiceObjectType = await _serviceObjectTypeDs.GetSelectListAsync();
  52 + // CatalogListVm vm = new CatalogListVm
  53 + // {
  54 + // DepartmentAffiliationSelectListDsM = DepartmentAffiliation.ToList(),
  55 + // SettlementSelectListDsM = Settlement.ToList(),
  56 + // ServiceObjectTypeSelectListDsM = ServiceObjectType.ToList(),
  57 + // RoadSelectListDsM = Road.ToList(),
  58 + // RegionSelectListDsM = Region.ToList()
  59 + // };
  60 + // return Json(vm);
  61 + // }
61 62
62 63
63 -// [HttpPost]  
64 -// public async Task<IActionResult> Create([FromBody] ServiceObjectEditDsM data)  
65 -// {  
66 -// var result = await _serviceObjectDs.CreateAsync(data);  
67 -// return Json(result);  
68 -// } 64 + // [HttpPost]
  65 + // public async Task<IActionResult> Create([FromBody] ServiceObjectEditDsM data)
  66 + // {
  67 + // var result = await _serviceObjectDs.CreateAsync(data);
  68 + // return Json(result);
  69 + // }
69 70
70 -// [HttpPost]  
71 -// public async Task<IActionResult> Update(int id, [FromBody] ServiceObjectEditDsM data){  
72 -// await _serviceObjectDs.UpdateAsync(data,id);  
73 -// return Json(String.Empty);  
74 -// } 71 + // [HttpPost]
  72 + // public async Task<IActionResult> Update(int id, [FromBody] ServiceObjectEditDsM data){
  73 + // await _serviceObjectDs.UpdateAsync(data,id);
  74 + // return Json(String.Empty);
  75 + // }
75 76
76 77
77 -// [HttpDelete]  
78 -// public async Task<IActionResult> Delete(int id)  
79 -// {  
80 -// try  
81 -// {  
82 -// int data = await _serviceObjectDs.DeleteAsync(id);  
83 -// return Json(data);  
84 -// }  
85 -// catch (ArgumentNullException )  
86 -// {  
87 -// return NotFound();  
88 -// }  
89 -// }  
90 -// }  
91 -// } 78 + // [HttpDelete]
  79 + // public async Task<IActionResult> Delete(int id)
  80 + // {
  81 + // try
  82 + // {
  83 + // int data = await _serviceObjectDs.DeleteAsync(id);
  84 + // return Json(data);
  85 + // }
  86 + // catch (ArgumentNullException )
  87 + // {
  88 + // return NotFound();
  89 + // }
  90 + // }
  91 + }
  92 +}
src/MapsModels/DsModels/PaginationDsM.cs
@@ -19,14 +19,19 @@ namespace MapsModels.DsModels @@ -19,14 +19,19 @@ namespace MapsModels.DsModels
19 } 19 }
20 } 20 }
21 public string orderType(){ 21 public string orderType(){
22 - if(sort == null){  
23 - return null;  
24 - }  
25 - if(sort.StartsWith("-")){  
26 - sort = sort.Substring(1);  
27 - return DESC; 22 + string orderType = null;
  23 + if(sort != null){
  24 + if(sort.StartsWith("-")){
  25 + sort = sort.Substring(1);
  26 + orderType = DESC;
  27 + } else {
  28 + orderType = ASC;
  29 + }
  30 +
  31 + sort = char.ToUpper(sort[0]) + sort.Substring(1);
28 } 32 }
29 - return ASC; 33 +
  34 + return orderType;
30 } 35 }
31 } 36 }
32 } 37 }
33 \ No newline at end of file 38 \ No newline at end of file
src/MapsModels/DsModels/RoadSurfaceEditDsM.cs
@@ -3,7 +3,13 @@ namespace MapsModels.DsModels @@ -3,7 +3,13 @@ namespace MapsModels.DsModels
3 public class RoadSurfaceEditDsM 3 public class RoadSurfaceEditDsM
4 { 4 {
5 public int Id { get; set; } 5 public int Id { get; set; }
6 -  
7 - 6 + public int? RoadId { get; set; }
  7 + public int? RegionId { get; set; }
  8 + public int? RoadDirectionId { get; set; }
  9 + public double? Begin { get; set; }
  10 + public double? End { get; set; }
  11 + public int? SurfaceTypeId { get; set; }
  12 + public int? SurfaceTreatmentId { get; set; }
  13 + public int? StateCommonId { get; set; }
8 } 14 }
9 } 15 }
10 \ No newline at end of file 16 \ No newline at end of file
src/MapsModels/ViewModels/RoadSurfaceListVm.cs 0 → 100644
  1 +using System.Collections.Generic;
  2 +using MapsModels.DsModels;
  3 +
  4 +namespace MapsModels.ViewModels
  5 +{
  6 + public class RoadSurfaceListVm
  7 + {
  8 + public List<RoadSurfaceEditDsM> RoadSurfaceEditDsM { get; set; }
  9 + }
  10 +}