diff --git a/src/Maps/Controllers/BusStopController.cs b/src/Maps/Controllers/BusStopController.cs index 8ed88d8..85306ba 100755 --- a/src/Maps/Controllers/BusStopController.cs +++ b/src/Maps/Controllers/BusStopController.cs @@ -37,7 +37,7 @@ namespace Maps.Controllers { var busStops = await _busStopDs.GetIndexListAsync(); - ListBusStopVm vm = new ListBusStopVm + BusStopListVm vm = new BusStopListVm { BusStopEditDsM = busStops.ToList() }; @@ -53,7 +53,7 @@ namespace Maps.Controllers var Road = await _roadDs.GetSelectListAsync(); var Region = await _regionDs.GetSelectListAsync(); - CreateBusStopVm vm = new CreateBusStopVm + CatalogListVm vm = new CatalogListVm { SurfaceTypeSelectListDsM = SurfaceType.ToList(), StateCommonSelectListDsM = StateCommon.ToList(), @@ -64,72 +64,21 @@ namespace Maps.Controllers return Json(vm); } - // GET: BusStop/Details/5 - public async Task Details(int id) - { - try{ - var busStop = await _busStopDs.FindOneDetailsAsync(id); - if (busStop == null) - { - return NotFound(); - } - DetailsBusStopVm vm = new DetailsBusStopVm - { - busStopDetailsDsM = busStop - }; - return Json(vm); - } catch { - return Json(false); - } - - } - // GET: BusStop/Create [HttpPost] - public async Task Create([FromBody] BusStopEditDsF data) + public async Task Create([FromBody] BusStopEditDsM data) { var result = await _busStopDs.SaveAsync(data); return Json(result); } [HttpPost] - public async Task Update(int id, [FromBody] BusStopEditDsF data){ + public async Task Update(int id, [FromBody] BusStopEditDsM data){ await _busStopDs.SaveAsync(data,id); return Json(String.Empty); } - // POST: BusStop/Create - // To protect from overposting attacks, please enable the specific properties you want to bind to, for - // more details see http://go.microsoft.com/fwlink/?LinkId=317598. - // [HttpPost] - // [ValidateAntiForgeryToken] - // public async Task Create(BusStopEditDsM busStop) - // { - // if (ModelState.IsValid) - // { - // await _busStopDs.SaveAsync(busStop); - // return Ok(); - // } else { - // return NotFound(); - // } - - // // var SurfaceType = await _surfaceTypeDs.GetSelectListAsync(); - // // var StateCommon = await _stateCommonDs.GetSelectListAsync(); - // // var Settlement = await _settlementDs.GetSelectListAsync(); - // // var Road = await _roadDs.GetSelectListAsync(); - // // var Region = await _regionDc.GetSelectListAsync(); - - // // CreateBusStopVm vm = new CreateBusStopVm - // // { - // // SurfaceTypeSelectListDsM = SurfaceType.ToList(), - // // StateCommonSelectListDsM = StateCommon.ToList(), - // // SettlementSelectListDsM = Settlement.ToList(), - // // RoadSelectListDsM = Road.ToList(), - // // RegionSelectListDsM = Region.ToList() - // // }; - // // return Json(vm); - // } - + [HttpDelete] public async Task Delete(int? id) { @@ -148,100 +97,5 @@ namespace Maps.Controllers return NotFound(); } } - - - // // GET: BusStop/Edit/5 - // public async Task Edit(int? id) - // { - // if (id == null) - // { - // return NotFound(); - // } - - // var busStop = await _context.BusStop.SingleOrDefaultAsync(m => m.BusStopId == id); - // if (busStop == null) - // { - // return NotFound(); - // } - // ViewData["RegionId"] = new SelectList(_context.Region, "RegionId", "RegionId", busStop.RegionId); - // ViewData["RoadId"] = new SelectList(_context.Road, "RoadId", "RoadId", busStop.RoadId); - // ViewData["SettlementId"] = new SelectList(_context.Settlement, "SettlementId", "Name", busStop.SettlementId); - // ViewData["StateCommonId"] = new SelectList(_context.StateCommon, "StateCommonId", "StateCommonId", busStop.StateCommonId); - // ViewData["SurfaceTypeId"] = new SelectList(_context.SurfaceType, "SurfaceTypeId", "SurfaceTypeId", busStop.SurfaceTypeId); - // return View(busStop); - // } - - // // POST: BusStop/Edit/5 - // // To protect from overposting attacks, please enable the specific properties you want to bind to, for - // // more details see http://go.microsoft.com/fwlink/?LinkId=317598. - // [HttpPost] - // [ValidateAntiForgeryToken] - // public async Task Edit(int id, [Bind("BusStopId,AreaLandAvailability,AreaStopAvailability,BalanceCost,BusStationCardId,CrossSectionNumber,DateActual,LocationLeft,LocationRight,PocketAvailability,Position,RegionId,RepairCertificate,RoadId,SettlementId,StateCommonId,SurfaceTypeId,ToiletAvailability,YearBuild,YearRepair")] BusStop busStop) - // { - // if (id != busStop.BusStopId) - // { - // return NotFound(); - // } - - // if (ModelState.IsValid) - // { - // try - // { - // _context.Update(busStop); - // await _context.SaveChangesAsync(); - // } - // catch (DbUpdateConcurrencyException) - // { - // if (!BusStopExists(busStop.BusStopId)) - // { - // return NotFound(); - // } - // else - // { - // throw; - // } - // } - // return RedirectToAction("Index"); - // } - // ViewData["RegionId"] = new SelectList(_context.Region, "RegionId", "RegionId", busStop.RegionId); - // ViewData["RoadId"] = new SelectList(_context.Road, "RoadId", "RoadId", busStop.RoadId); - // ViewData["SettlementId"] = new SelectList(_context.Settlement, "SettlementId", "Name", busStop.SettlementId); - // ViewData["StateCommonId"] = new SelectList(_context.StateCommon, "StateCommonId", "StateCommonId", busStop.StateCommonId); - // ViewData["SurfaceTypeId"] = new SelectList(_context.SurfaceType, "SurfaceTypeId", "SurfaceTypeId", busStop.SurfaceTypeId); - // return View(busStop); - // } - - // // GET: BusStop/Delete/5 - // public async Task Delete(int? id) - // { - // if (id == null) - // { - // return NotFound(); - // } - - // var busStop = await _context.BusStop.SingleOrDefaultAsync(m => m.BusStopId == id); - // if (busStop == null) - // { - // return NotFound(); - // } - - // return View(busStop); - // } - - // // POST: BusStop/Delete/5 - // [HttpPost, ActionName("Delete")] - // [ValidateAntiForgeryToken] - // public async Task DeleteConfirmed(int id) - // { - // var busStop = await _context.BusStop.SingleOrDefaultAsync(m => m.BusStopId == id); - // _context.BusStop.Remove(busStop); - // await _context.SaveChangesAsync(); - // return RedirectToAction("Index"); - // } - - // private bool BusStopExists(int id) - // { - // return _context.BusStop.Any(e => e.BusStopId == id); - // } } } diff --git a/src/Maps/Controllers/DirectoryController.cs b/src/Maps/Controllers/DirectoryController.cs deleted file mode 100644 index c447c93..0000000 --- a/src/Maps/Controllers/DirectoryController.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.EntityFrameworkCore; -using MapsDb; -using MapsDb.Interfaces; -using MapsDb.DataService; -using MapsModels.ViewModels; -using MapsModels.DsModels; -using System; -namespace Maps.Controllers -{ - - public class DirectoryController : Controller{ - - private readonly IRoadDs _roadDs; - private readonly ISettlementDs _settlementDs; - private readonly IStateCommonDs _stateCommonDs; - private readonly IRegionDs _regionDs; - private readonly ISurfaceTypeDs _surfaceTypeDs; - public DirectoryController( - IBusStopDs BusStopDs, - IRoadDs RoadDs, - ISettlementDs SettlementDs, - IRegionDs RegionDs, - IStateCommonDs StateCommonDs, - ISurfaceTypeDs SurfaceTypeDs - ){ - _roadDs = RoadDs; - _settlementDs = SettlementDs; - _stateCommonDs = StateCommonDs; - _regionDs = RegionDs; - _surfaceTypeDs = SurfaceTypeDs; - } - - public async Task SurfaceTypeDs() - { - var SurfaceType = await _surfaceTypeDs.GetSelectListAsync(); - - DirectoryVm vm = new DirectoryVm - { - SurfaceTypeSelectListDsM = SurfaceType.ToList(), - }; - return Json(vm); - } - public async Task SettlementDs() - { - var Settlement = await _settlementDs.GetSelectListAsync(); - - - DirectoryVm vm = new DirectoryVm - { - SettlementSelectListDsM = Settlement.ToList(), - }; - return Json(vm); - } - public async Task RoadDs() - { - var Road = await _roadDs.GetSelectListAsync(); - - - DirectoryVm vm = new DirectoryVm - { - RoadSelectListDsM = Road.ToList(), - }; - return Json(vm); - } - public async Task RegionDs() - { - var Region = await _regionDs.GetSelectListAsync(); - - DirectoryVm vm = new DirectoryVm - { - RegionSelectListDsM = Region.ToList() - }; - return Json(vm); - } - public async Task StateCommonDs() - { - var StateCommon = await _stateCommonDs.GetSelectListAsync(); - - - DirectoryVm vm = new DirectoryVm - { - StateCommonSelectListDsM = StateCommon.ToList(), - }; - return Json(vm); - } - } - -} \ No newline at end of file diff --git a/src/Maps/Controllers/ServiceObjectController.cs b/src/Maps/Controllers/ServiceObjectController.cs new file mode 100755 index 0000000..f3c4ec3 --- /dev/null +++ b/src/Maps/Controllers/ServiceObjectController.cs @@ -0,0 +1,97 @@ +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; +using MapsDb; +using MapsDb.Interfaces; +using MapsDb.DataService; +using MapsModels.ViewModels; +using MapsModels.DsModels; +using System; + +namespace Maps.Controllers +{ + public class ServiceObjectController : Controller + { + private readonly IServiceObjectDs _serviceObjectDs; + private readonly IRoadDs _roadDs; + private readonly ISettlementDs _settlementDs; + private readonly IRegionDs _regionDs; + private readonly IDepartmentAffiliationDs _departmentAffiliationDs; + + public ServiceObjectController(IServiceObjectDs ServiceObjectDs, IRoadDs RoadDs, ISettlementDs SettlementDs, IRegionDs RegionDs, IDepartmentAffiliationDs DepartmentAffiliationDs) + { + _serviceObjectDs = ServiceObjectDs; + _roadDs = RoadDs; + _settlementDs = SettlementDs; + _regionDs = RegionDs; + _departmentAffiliationDs = DepartmentAffiliationDs; + } + + // GET: BusStop + [HttpGet] + public async Task Index() + { + var Data = await _serviceObjectDs.GetIndexListAsync(); + + ServiceObjectListVm vm = new ServiceObjectListVm + { + ServiceObjectEditDsM = Data.ToList() + }; + + return Json(vm); + } + + [HttpGet] + public async Task Directory(){ + var DepartmentAffiliation = await _departmentAffiliationDs.GetSelectListAsync(); + var Settlement = await _settlementDs.GetSelectListAsync(); + var Road = await _roadDs.GetSelectListAsync(); + var Region = await _regionDs.GetSelectListAsync(); + + CatalogListVm vm = new CatalogListVm + { + DepartmentAffiliationDsM = DepartmentAffiliation.ToList(), + SettlementSelectListDsM = Settlement.ToList(), + RoadSelectListDsM = Road.ToList(), + RegionSelectListDsM = Region.ToList() + }; + return Json(vm); + } + + + [HttpPost] + public async Task Create([FromBody] ServiceObjectEditDsM data) + { + var result = await _serviceObjectDs.SaveAsync(data); + return Json(result); + } + + [HttpPost] + public async Task Update(int id, [FromBody] ServiceObjectEditDsM data){ + await _serviceObjectDs.SaveAsync(data,id); + return Json(String.Empty); + } + + + [HttpDelete] + public async Task Delete(int? id) + { + try + { + if (id == null) + { + return NotFound(); + } + + int data = await _serviceObjectDs.DeleteAsync(id); + return Json(data); + } + catch (ArgumentNullException ) + { + return NotFound(); + } + } + } +} diff --git a/src/Maps/Startup.cs b/src/Maps/Startup.cs index 5b7de23..6f25d3c 100644 --- a/src/Maps/Startup.cs +++ b/src/Maps/Startup.cs @@ -45,11 +45,13 @@ namespace Maps services.AddScoped(); services.AddScoped(); - services.AddScoped(); + services.AddScoped(); services.AddScoped(); - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); // Add framework services. services.AddApplicationInsightsTelemetry(Configuration); diff --git a/src/MapsDb/DataService/BusStopDs.cs b/src/MapsDb/DataService/BusStopDs.cs index 9a05ea7..c96d704 100644 --- a/src/MapsDb/DataService/BusStopDs.cs +++ b/src/MapsDb/DataService/BusStopDs.cs @@ -37,42 +37,42 @@ namespace MapsDb.DataService }).OrderByDescending(BusStop => BusStop.BusStopId).ToList(); } - public Task SaveAsync(BusStopEditDsF busStop, int? id = null){ + public Task SaveAsync(BusStopEditDsM busStop, int? id = null){ return Task.Factory.StartNew(()=> { return Save(busStop, id); }); } - private BusStop Save(BusStopEditDsF busStop, int? id) + private BusStop Save(BusStopEditDsM busStop, int? id) { BusStop Bs = new BusStop{ - RoadId = busStop.roadId, - RegionId = busStop.regionId, - SettlementId = busStop.settlementId, - LocationLeft = busStop.locationLeft, - LocationRight = busStop.locationRight, - SurfaceTypeId = busStop.surfaceTypeId, - AreaStopAvailability = busStop.areaStopAvailability, - AreaLandAvailability = busStop.areaLandAvailability, - PocketAvailability = busStop.pocketAvailability, - ToiletAvailability = busStop.toiletAvailability, - YearBuild = busStop.yearBuild, - YearRepair = busStop.yearRepair, - StateCommonId = busStop.stateCommonId + RoadId = busStop.RoadId, + RegionId = busStop.RegionId, + SettlementId = busStop.SettlementId, + LocationLeft = busStop.LocationLeft, + LocationRight = busStop.LocationRight, + SurfaceTypeId = busStop.SurfaceTypeId, + AreaStopAvailability = busStop.AreaStopAvailability, + AreaLandAvailability = busStop.AreaLandAvailability, + PocketAvailability = busStop.PocketAvailability, + ToiletAvailability = busStop.ToiletAvailability, + YearBuild = busStop.YearBuild, + YearRepair = busStop.YearRepair, + StateCommonId = busStop.StateCommonId }; var busStopFromDb = _context.BusStop.FirstOrDefault(x => x.BusStopId == id); if(busStopFromDb != null) { - busStopFromDb.RoadId = busStop.roadId; - busStopFromDb.RegionId = busStop.regionId; - busStopFromDb.SettlementId = busStop.settlementId; - busStopFromDb.LocationLeft = busStop.locationLeft; - busStopFromDb.LocationRight = busStop.locationRight; - busStopFromDb.SurfaceTypeId = busStop.surfaceTypeId; - busStopFromDb.AreaStopAvailability = busStop.areaStopAvailability; - busStopFromDb.AreaLandAvailability = busStop.areaLandAvailability; - busStopFromDb.PocketAvailability = busStop.pocketAvailability; - busStopFromDb.ToiletAvailability = busStop.toiletAvailability; - busStopFromDb.YearBuild = busStop.yearBuild; - busStopFromDb.YearRepair = busStop.yearRepair; - busStopFromDb.StateCommonId = busStop.stateCommonId; + busStopFromDb.RoadId = busStop.RoadId; + busStopFromDb.RegionId = busStop.RegionId; + busStopFromDb.SettlementId = busStop.SettlementId; + busStopFromDb.LocationLeft = busStop.LocationLeft; + busStopFromDb.LocationRight = busStop.LocationRight; + busStopFromDb.SurfaceTypeId = busStop.SurfaceTypeId; + busStopFromDb.AreaStopAvailability = busStop.AreaStopAvailability; + busStopFromDb.AreaLandAvailability = busStop.AreaLandAvailability; + busStopFromDb.PocketAvailability = busStop.PocketAvailability; + busStopFromDb.ToiletAvailability = busStop.ToiletAvailability; + busStopFromDb.YearBuild = busStop.YearBuild; + busStopFromDb.YearRepair = busStop.YearRepair; + busStopFromDb.StateCommonId = busStop.StateCommonId; } else { @@ -81,26 +81,6 @@ namespace MapsDb.DataService _context.SaveChanges(); return Bs; } - public Task FindOneDetailsAsync(int Id){ - return Task.Factory.StartNew(()=> { return FindOneDetails(Id); }); - } - private BusStopDetailsDsM FindOneDetails(int Id){ - return _context.BusStop.Where(x => x.BusStopId == Id).Select(x => new BusStopDetailsDsM{ - BusStopId = x.BusStopId, - Road = x.Road.Name, - Region = x.Region.Name, - Settlement = x.Settlement.Name, - LocationLeft = x.LocationLeft, - LocationRight = x.LocationRight, - StateCommon = x.StateCommon.Value, - AreaStopAvailability = x.AreaStopAvailability, - AreaLandAvailability = x.AreaLandAvailability, - PocketAvailability = x.PocketAvailability, - ToiletAvailability = x.ToiletAvailability, - YearBuild = x.YearBuild, - YearRepair = x.YearRepair - }).Single(); - } public async Task DeleteAsync(int? Id) { var busStop = await _context.BusStop.SingleOrDefaultAsync(x => x.BusStopId == Id); diff --git a/src/MapsDb/DataService/DepartmentAffiliationDs.cs b/src/MapsDb/DataService/DepartmentAffiliationDs.cs new file mode 100644 index 0000000..6865c15 --- /dev/null +++ b/src/MapsDb/DataService/DepartmentAffiliationDs.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using MapsDb.Interfaces; +using MapsDb.Models; +using MapsModels.DsModels; +namespace MapsDb.DataService +{ + public class DepartmentAffiliationDs : IDepartmentAffiliationDs + { + private PostgresDbContext _context; + public DepartmentAffiliationDs(){ + _context = new PostgresDbContext(); + } + public Task> GetSelectListAsync(){ + return Task.Factory.StartNew(GetSelectList); + } + private IList GetSelectList() + { + return _context.DepartmentAffiliation.Select(x => new DepartmentAffiliationListDsM + { + DepartmentAffiliationId = x.DepartmentAffiliationId, + Name = x.Name + }).ToList(); + } + + } +} \ No newline at end of file diff --git a/src/MapsDb/DataService/RoadDs.cs b/src/MapsDb/DataService/RoadDs.cs index ec84b4a..cac9655 100644 --- a/src/MapsDb/DataService/RoadDs.cs +++ b/src/MapsDb/DataService/RoadDs.cs @@ -6,10 +6,10 @@ using MapsDb.Models; using MapsModels.DsModels; namespace MapsDb.DataService { - public class RoadDc : IRoadDs + public class RoadDs : IRoadDs { private PostgresDbContext _context; - public RoadDc(){ + public RoadDs(){ _context = new PostgresDbContext(); } public Task> GetSelectListAsync(){ diff --git a/src/MapsDb/DataService/ServiceObjectDs.cs b/src/MapsDb/DataService/ServiceObjectDs.cs new file mode 100644 index 0000000..d9b4b31 --- /dev/null +++ b/src/MapsDb/DataService/ServiceObjectDs.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using MapsDb.Interfaces; +using MapsDb.Models; +using MapsModels.DsModels; +using Microsoft.EntityFrameworkCore; +namespace MapsDb.DataService +{ + public class ServiceObjectDs : IServiceObjectDs + { + private PostgresDbContext _context; + public ServiceObjectDs(){ + _context = new PostgresDbContext(); + } + public Task> GetIndexListAsync(){ + return Task.Factory.StartNew(GetAllServiceObject); + } + private IList GetAllServiceObject() + { + return _context.ServiceObject.Select(ServiceObject => new ServiceObjectEditDsM + { + ServiceObjectId = ServiceObject.ServiceObjectId, + RoadId = ServiceObject.RoadId, + RegionId = ServiceObject.RegionId, + SettlementId = ServiceObject.SettlementId, + LocationLeft = ServiceObject.LocationLeft, + LocationRight = ServiceObject.LocationRight, + ServiceObjectTypeId = ServiceObject.ServiceObjectTypeId, + DepartmentAffiliationId = ServiceObject.DepartmentAffiliationId, + LocationAxis = ServiceObject.LocationAxis, + Distance = ServiceObject.Distance, + Capacity = ServiceObject.Capacity, + ArrangementElements = ServiceObject.ArrangementElements, + }).OrderByDescending(ServiceObject => ServiceObject.ServiceObjectId).ToList(); + } + + public Task SaveAsync(ServiceObjectEditDsM serviceObject, int? id = null){ + return Task.Factory.StartNew(()=> { return Save(serviceObject, id); }); + } + private ServiceObject Save(ServiceObjectEditDsM serviceObject, int? id) + { + ServiceObject Data = new ServiceObject{ + ServiceObjectId = serviceObject.ServiceObjectId, + RoadId = serviceObject.RoadId, + RegionId = serviceObject.RegionId, + SettlementId = serviceObject.SettlementId, + LocationLeft = serviceObject.LocationLeft, + LocationRight = serviceObject.LocationRight, + ServiceObjectTypeId = serviceObject.ServiceObjectTypeId, + DepartmentAffiliationId = serviceObject.DepartmentAffiliationId, + LocationAxis = serviceObject.LocationAxis, + Distance = serviceObject.Distance, + Capacity = serviceObject.Capacity, + ArrangementElements = serviceObject.ArrangementElements, + }; + var ServiceObjectFromDb = _context.ServiceObject.FirstOrDefault(x => x.ServiceObjectId == id); + if(ServiceObjectFromDb != null) + { + ServiceObjectFromDb.ServiceObjectId = Data.ServiceObjectId; + ServiceObjectFromDb.RoadId = Data.RoadId; + ServiceObjectFromDb.RegionId = Data.RegionId; + ServiceObjectFromDb.SettlementId = Data.SettlementId; + ServiceObjectFromDb.LocationLeft = Data.LocationLeft; + ServiceObjectFromDb.LocationRight = Data.LocationRight; + ServiceObjectFromDb.ServiceObjectTypeId = Data.ServiceObjectTypeId; + ServiceObjectFromDb.DepartmentAffiliationId = Data.DepartmentAffiliationId; + ServiceObjectFromDb.LocationAxis = Data.LocationAxis; + ServiceObjectFromDb.Distance = Data.Distance; + ServiceObjectFromDb.Capacity = Data.Capacity; + ServiceObjectFromDb.ArrangementElements = Data.ArrangementElements; + } + else + { + _context.ServiceObject.Add(Data); + } + _context.SaveChanges(); + return Data; + } + public async Task DeleteAsync(int? Id) + { + var ServiceObject = await _context.ServiceObject.SingleOrDefaultAsync(x => x.ServiceObjectId == Id); + _context.ServiceObject.Remove(ServiceObject); + return await _context.SaveChangesAsync(); + } + } +} \ No newline at end of file diff --git a/src/MapsDb/DataService/SettlementDs.cs b/src/MapsDb/DataService/SettlementDs.cs index 09f01cd..18d60d2 100644 --- a/src/MapsDb/DataService/SettlementDs.cs +++ b/src/MapsDb/DataService/SettlementDs.cs @@ -6,10 +6,10 @@ using MapsDb.Models; using MapsModels.DsModels; namespace MapsDb.DataService { - public class SettlementDc : ISettlementDs + public class SettlementDs : ISettlementDs { private PostgresDbContext _context; - public SettlementDc(){ + public SettlementDs(){ _context = new PostgresDbContext(); } public Task> GetSelectListAsync(){ diff --git a/src/MapsDb/DataService/StateCommonDs.cs b/src/MapsDb/DataService/StateCommonDs.cs index 189b47f..b7b63a4 100644 --- a/src/MapsDb/DataService/StateCommonDs.cs +++ b/src/MapsDb/DataService/StateCommonDs.cs @@ -6,10 +6,10 @@ using MapsDb.Models; using MapsModels.DsModels; namespace MapsDb.DataService { - public class StateCommonDc : IStateCommonDs + public class StateCommonDs : IStateCommonDs { private PostgresDbContext _context; - public StateCommonDc(){ + public StateCommonDs(){ _context = new PostgresDbContext(); } public Task> GetSelectListAsync(){ diff --git a/src/MapsDb/DataService/SurfaceTypeDs.cs b/src/MapsDb/DataService/SurfaceTypeDs.cs index b8cfbd4..67e0e5e 100644 --- a/src/MapsDb/DataService/SurfaceTypeDs.cs +++ b/src/MapsDb/DataService/SurfaceTypeDs.cs @@ -6,10 +6,10 @@ using MapsDb.Models; using MapsModels.DsModels; namespace MapsDb.DataService { - public class SurfaceTypeDc : ISurfaceTypeDs + public class SurfaceTypeDs : ISurfaceTypeDs { private PostgresDbContext _context; - public SurfaceTypeDc(){ + public SurfaceTypeDs(){ _context = new PostgresDbContext(); } public Task> GetSelectListAsync(){ diff --git a/src/MapsDb/Interfaces/IBusStopDs.cs b/src/MapsDb/Interfaces/IBusStopDs.cs index 0eb1920..9d4c508 100644 --- a/src/MapsDb/Interfaces/IBusStopDs.cs +++ b/src/MapsDb/Interfaces/IBusStopDs.cs @@ -7,8 +7,7 @@ namespace MapsDb.Interfaces public interface IBusStopDs { Task> GetIndexListAsync(); - Task SaveAsync(BusStopEditDsF busStop, int? id = null); - Task FindOneDetailsAsync(int Id); + Task SaveAsync(BusStopEditDsM busStop, int? id = null); Task DeleteAsync(int? Id); } } \ No newline at end of file diff --git a/src/MapsDb/Interfaces/IDepartmentAffiliationDs.cs b/src/MapsDb/Interfaces/IDepartmentAffiliationDs.cs new file mode 100644 index 0000000..c150f74 --- /dev/null +++ b/src/MapsDb/Interfaces/IDepartmentAffiliationDs.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using MapsModels.DsModels; +using MapsDb.Models; +namespace MapsDb.Interfaces +{ + public interface IDepartmentAffiliationDs + { + Task> GetSelectListAsync(); + } +} \ No newline at end of file diff --git a/src/MapsDb/Interfaces/IServiceObjectDs.cs b/src/MapsDb/Interfaces/IServiceObjectDs.cs new file mode 100644 index 0000000..c00eee4 --- /dev/null +++ b/src/MapsDb/Interfaces/IServiceObjectDs.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using MapsModels.DsModels; +using MapsDb.Models; +namespace MapsDb.Interfaces +{ + public interface IServiceObjectDs + { + Task> GetIndexListAsync(); + Task SaveAsync(ServiceObjectEditDsM serviceObject, int? id = null); + Task DeleteAsync(int? Id); + + } +} \ No newline at end of file diff --git a/src/MapsModels/DsModels/BusStopDetailsDsM.cs b/src/MapsModels/DsModels/BusStopDetailsDsM.cs deleted file mode 100644 index 655310d..0000000 --- a/src/MapsModels/DsModels/BusStopDetailsDsM.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace MapsModels.DsModels -{ - public class BusStopDetailsDsM - { - public int BusStopId { get; set; } - public string Road { get; set; } - public string Region { get; set; } - public string Settlement { get; set; } - public double? LocationLeft { get; set; } - public double? LocationRight { get; set; } - public string SurfaceType { get; set; } - public int? AreaStopAvailability { get; set; } - public int? AreaLandAvailability { get; set; } - public int? PocketAvailability { get; set; } - public int? ToiletAvailability { get; set; } - public int? YearBuild { get; set; } - public int? YearRepair { get; set; } - public string StateCommon { get; set; } - - } -} \ No newline at end of file diff --git a/src/MapsModels/DsModels/BusStopEditDsF.cs b/src/MapsModels/DsModels/BusStopEditDsF.cs deleted file mode 100644 index 8e31f5d..0000000 --- a/src/MapsModels/DsModels/BusStopEditDsF.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace MapsModels.DsModels -{ - public class BusStopEditDsF - { - public int? busStopId { get; set; } - public int? roadId { get; set; } - public int? regionId { get; set; } - public int? settlementId { get; set; } - public double? locationLeft { get; set; } - public double? locationRight { get; set; } - public int? surfaceTypeId { get; set; } - public int? areaStopAvailability { get; set; } - public int? areaLandAvailability { get; set; } - public int? pocketAvailability { get; set; } - public int? toiletAvailability { get; set; } - public int? yearBuild { get; set; } - public int? yearRepair { get; set; } - public int? stateCommonId { get; set; } - - } -} \ No newline at end of file diff --git a/src/MapsModels/DsModels/BusStopListDsM.cs b/src/MapsModels/DsModels/BusStopListDsM.cs deleted file mode 100644 index 1b4c1e8..0000000 --- a/src/MapsModels/DsModels/BusStopListDsM.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace MapsModels.DsModels -{ - public class BusStopListDsM - { - public string Road { get; set; } - public string Region { get; set; } - public string Settlement { get; set; } - public double? LocationLeft { get; set; } - public double? LocationRight { get; set; } - public string StateCommon { get; set; } - } -} \ No newline at end of file diff --git a/src/MapsModels/DsModels/DepartmentAffiliationListDsM.cs b/src/MapsModels/DsModels/DepartmentAffiliationListDsM.cs new file mode 100644 index 0000000..5acb172 --- /dev/null +++ b/src/MapsModels/DsModels/DepartmentAffiliationListDsM.cs @@ -0,0 +1,8 @@ +namespace MapsModels.DsModels +{ + public class DepartmentAffiliationListDsM + { + public int DepartmentAffiliationId { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/MapsModels/DsModels/ServiceObjectEditDsM.cs b/src/MapsModels/DsModels/ServiceObjectEditDsM.cs new file mode 100644 index 0000000..7031b14 --- /dev/null +++ b/src/MapsModels/DsModels/ServiceObjectEditDsM.cs @@ -0,0 +1,19 @@ +namespace MapsModels.DsModels +{ + public class ServiceObjectEditDsM + { + public int ServiceObjectId { get; set; } + public int? RoadId { get; set; } + public int? RegionId { get; set; } + public int? ServiceObjectTypeId { get; set; } + public int? SettlementId { get; set; } + public int? DepartmentAffiliationId { get; set; } + public double? LocationRight { get; set; } + public double? LocationLeft { get; set; } + public double? LocationAxis { get; set; } + public double? Distance { get; set; } + public double? Capacity { get; set; } + public string ArrangementElements { get; set; } + + } +} \ No newline at end of file diff --git a/src/MapsModels/ViewModels/BusStopListVm.cs b/src/MapsModels/ViewModels/BusStopListVm.cs new file mode 100644 index 0000000..336ebb4 --- /dev/null +++ b/src/MapsModels/ViewModels/BusStopListVm.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using MapsModels.DsModels; + +namespace MapsModels.ViewModels +{ + public class BusStopListVm + { + public List BusStopEditDsM { get; set; } + } +} diff --git a/src/MapsModels/ViewModels/CatalogListVm.cs b/src/MapsModels/ViewModels/CatalogListVm.cs new file mode 100644 index 0000000..282686b --- /dev/null +++ b/src/MapsModels/ViewModels/CatalogListVm.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using MapsModels.DsModels; + +namespace MapsModels.ViewModels +{ + public class CatalogListVm + { + public List DepartmentAffiliationDsM { get; set; } + public List SurfaceTypeSelectListDsM { get; set; } + public List StateCommonSelectListDsM { get; set; } + public List SettlementSelectListDsM { get; set; } + public List RoadSelectListDsM { get; set; } + public List RegionSelectListDsM { get; set; } + } +} diff --git a/src/MapsModels/ViewModels/CreateBusStopVm.cs b/src/MapsModels/ViewModels/CreateBusStopVm.cs deleted file mode 100644 index 861fdd8..0000000 --- a/src/MapsModels/ViewModels/CreateBusStopVm.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using MapsModels.DsModels; - -namespace MapsModels.ViewModels -{ - public class CreateBusStopVm - { - public List SurfaceTypeSelectListDsM { get; set; } - public List StateCommonSelectListDsM { get; set; } - public List SettlementSelectListDsM { get; set; } - public List RoadSelectListDsM { get; set; } - public List RegionSelectListDsM { get; set; } - } -} diff --git a/src/MapsModels/ViewModels/DetailsBusStopVm.cs b/src/MapsModels/ViewModels/DetailsBusStopVm.cs deleted file mode 100644 index edf4709..0000000 --- a/src/MapsModels/ViewModels/DetailsBusStopVm.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using MapsModels.DsModels; - -namespace MapsModels.ViewModels -{ - public class DetailsBusStopVm - { - public BusStopDetailsDsM busStopDetailsDsM { get; set; } - } -} diff --git a/src/MapsModels/ViewModels/DirectoryVm.cs b/src/MapsModels/ViewModels/DirectoryVm.cs deleted file mode 100644 index 8131bf2..0000000 --- a/src/MapsModels/ViewModels/DirectoryVm.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using MapsModels.DsModels; - -namespace MapsModels.ViewModels -{ - public class DirectoryVm - { - public List SurfaceTypeSelectListDsM { get; set; } - public List StateCommonSelectListDsM { get; set; } - public List SettlementSelectListDsM { get; set; } - public List RoadSelectListDsM { get; set; } - public List RegionSelectListDsM { get; set; } - } -} diff --git a/src/MapsModels/ViewModels/ListBusStopVm.cs b/src/MapsModels/ViewModels/ListBusStopVm.cs deleted file mode 100644 index b027f8e..0000000 --- a/src/MapsModels/ViewModels/ListBusStopVm.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using MapsModels.DsModels; - -namespace MapsModels.ViewModels -{ - public class ListBusStopVm - { - public List BusStopEditDsM { get; set; } - } -} diff --git a/src/MapsModels/ViewModels/ServiceObjectListVm.cs b/src/MapsModels/ViewModels/ServiceObjectListVm.cs new file mode 100644 index 0000000..6cf3632 --- /dev/null +++ b/src/MapsModels/ViewModels/ServiceObjectListVm.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using MapsModels.DsModels; + +namespace MapsModels.ViewModels +{ + public class ServiceObjectListVm + { + public List ServiceObjectEditDsM { get; set; } + } +} -- libgit2 0.21.4