コード例 #1
0
        public IActionResult UpdateDescription(AdminSpaceModel spaceItem)
        {
            _dbProvider.ContextAction(connection =>
            {
                if (spaceItem.MapType == MapTypes.Galaxy)
                {
                    var galaxy       = _galaxyService.GetGalaxyById(connection, (byte)spaceItem.Id, i => i);
                    galaxy.Translate = spaceItem.Translate;
                    _galaxyService.AddOrUpdate(connection, galaxy);
                }
                else if (spaceItem.MapType == MapTypes.Sector)
                {
                    var sector       = _sectorsService.GetById(connection, (short)spaceItem.Id, i => i);
                    sector.Translate = spaceItem.Translate;
                    _sectorsService.AddOrUpdate(connection, sector);
                }
                else if (spaceItem.MapType == MapTypes.Star)
                {
                    var star         = _systemService.GetDetailSystemBySystemId(connection, spaceItem.Id, i => i);
                    star.Description = spaceItem.Translate;
                    _systemService.AddOrUpdateDetailSystem(connection, star);
                }

                else if (spaceItem.MapType == MapTypes.Planet)
                {
                    var planet         = _detailPlanetService.GetPlanet(connection, spaceItem.Id, i => i);
                    planet.Description = spaceItem.Translate;
                    _detailPlanetService.AddOrUpdate(connection, planet);
                }
                else if (spaceItem.MapType == MapTypes.Satellite)
                {
                    var moon         = _moonService.GetDetailMoon(connection, spaceItem.Id);
                    moon.Description = spaceItem.Translate;
                    _moonService.AddOrUpdateDetailMoon(connection, moon);
                }
                return(true);
            });


            return(Json(true));
        }