예제 #1
0
        public async Task<IActionResult> DeleteMap(string id) 
        {
            string error = await CheckMapReferencesForDeletion(id);
            if(!string.IsNullOrEmpty(error))
            {
                return BadRequest(error);
            }

            await DeleteAdditionalMapReferences(id);

            KartaMap map = await _mapDbAccess.GetMapById(id);
            await _mapDbAccess.DeleteMap(map);
            _logger.LogInformation("Map was deleted.");

            _mapImageAccess.DeleteMapFolder(map.Id);
            _logger.LogInformation("Map image was deleted.");

            await _timelineService.AddTimelineEntry(map.ProjectId, TimelineEvent.KartaMapDeleted, map.Name);
            return Ok(id);
        }
예제 #2
0
        public async Task <IActionResult> DeleteMap(string id)
        {
            List <KartaMap> kartaMaps = await _mapDbAccess.GetAllMapsMapIsMarkedIn(id);

            if (kartaMaps.Count > 0)
            {
                string markedInMaps = string.Join(", ", kartaMaps.Select(p => p.Name));
                return(StatusCode((int)HttpStatusCode.BadRequest, _localizer["CanNotDeleteMapMarkedInKartaMap", markedInMaps].Value));
            }

            KartaMap map = await _mapDbAccess.GetMapById(id);

            await _mapDbAccess.DeleteMap(map);

            _logger.LogInformation("Map was deleted.");

            _mapImageAccess.DeleteMapFolder(map.Id);
            _logger.LogInformation("Map image was deleted.");

            await _timelineService.AddTimelineEntry(TimelineEvent.KartaMapDeleted, map.Name);

            return(Ok(id));
        }