Exemplo n.º 1
0
        public async Task <IActionResult> RenameMap(string id, string name)
        {
            // Update map
            KartaMap map = await _mapDbAccess.GetMapById(id);

            if (map == null)
            {
                return(StatusCode((int)HttpStatusCode.NotFound));
            }

            bool hasNameChanged = map.Name != name;

            map.Name = name;
            await this.SetModifiedData(_userManager, map);

            await _mapDbAccess.RenameMap(map);

            if (hasNameChanged)
            {
                await this.SyncMapNameToMarkers(id, name);
            }

            await _timelineService.AddTimelineEntry(TimelineEvent.KartaMapUpdated, name, id);

            return(Ok(id));
        }