@@ -102,7 +102,10 @@ public async Task<IActionResult> ViewType(int poiTypeId)
102102
103103 var type = await _mappingService . GetTypeByIdAsync ( poiTypeId ) ;
104104
105- if ( type == null || type . DepartmentId != DepartmentId )
105+ if ( type == null )
106+ return NotFound ( ) ;
107+
108+ if ( type . DepartmentId != DepartmentId )
106109 return Unauthorized ( ) ;
107110
108111 model . Type = type ;
@@ -210,7 +213,10 @@ public async Task<IActionResult> EditLayer(string layerId)
210213 model . CenterCoordinates = await _departmentSettingsService . GetMapCenterCoordinatesAsync ( model . Department ) ;
211214 var layer = await _mappingService . GetMapLayersByIdAsync ( layerId ) ;
212215
213- if ( layer == null || layer . DepartmentId != DepartmentId || layer . IsDeleted )
216+ if ( layer == null || layer . IsDeleted )
217+ return NotFound ( ) ;
218+
219+ if ( layer . DepartmentId != DepartmentId )
214220 return Unauthorized ( ) ;
215221
216222 var feature = layer . Data . Convert ( ) ;
@@ -262,7 +268,10 @@ public async Task<IActionResult> DeleteLayer(string layerId)
262268
263269 var layer = await _mappingService . GetMapLayersByIdAsync ( layerId ) ;
264270
265- if ( layer == null || layer . DepartmentId != DepartmentId || layer . IsDeleted )
271+ if ( layer == null || layer . IsDeleted )
272+ return NotFound ( ) ;
273+
274+ if ( layer . DepartmentId != DepartmentId )
266275 return Unauthorized ( ) ;
267276
268277 layer . IsDeleted = true ;
@@ -621,7 +630,10 @@ public async Task<IActionResult> GetTypesMapData(int poiTypeId)
621630
622631 var poiType = await _mappingService . GetTypeByIdAsync ( poiTypeId ) ;
623632
624- if ( poiType == null || poiType . DepartmentId != DepartmentId )
633+ if ( poiType == null )
634+ return NotFound ( ) ;
635+
636+ if ( poiType . DepartmentId != DepartmentId )
625637 return Unauthorized ( ) ;
626638
627639 foreach ( var poi in poiType . Pois )
@@ -648,7 +660,10 @@ public async Task<IActionResult> GetPoisForType(int poiTypeId)
648660
649661 var poiType = await _mappingService . GetTypeByIdAsync ( poiTypeId ) ;
650662
651- if ( poiType == null || poiType . DepartmentId != DepartmentId )
663+ if ( poiType == null )
664+ return NotFound ( ) ;
665+
666+ if ( poiType . DepartmentId != DepartmentId )
652667 return Unauthorized ( ) ;
653668
654669 foreach ( var poi in poiType . Pois )
@@ -700,9 +715,15 @@ public async Task<IActionResult> StationRouting(int stationId, int callId)
700715 var station = await _departmentGroupsService . GetGroupByIdAsync ( stationId ) ;
701716 var call = await _callsService . GetCallByIdAsync ( callId ) ;
702717
718+ if ( station == null )
719+ return NotFound ( ) ;
720+
703721 if ( station . DepartmentId != DepartmentId )
704722 return Unauthorized ( ) ;
705723
724+ if ( call == null )
725+ return NotFound ( ) ;
726+
706727 if ( call . DepartmentId != DepartmentId )
707728 return Unauthorized ( ) ;
708729
0 commit comments