Esempio n. 1
0
        public async Task <IHttpActionResult> AddTerritory(iS3TerritoryHandle handle)
        {
            if (handle == null)
            {
                return(BadRequest("Argument Null"));
            }

            iS3TerritoryHandle newHandle = await MiniServer.AddTerritory(handle);

            return(Ok(newHandle));
        }
Esempio n. 2
0
        // Add territory using the corresponding information in handle
        // Returns the newly added territory handle (not the input one).
        //
        public static async Task <iS3TerritoryHandle> AddTerritory(
            iS3TerritoryHandle territoryHandle)
        {
            iS3TerritoryHandle newHandle =
                await MiniServer.AddTerritoryHandle(territoryHandle.Name,
                                                    territoryHandle.Type, territoryHandle.DbName);

            Type         t         = MiniServer.GetType(newHandle.Type);
            iS3Territory territory = (iS3Territory)
                                     Activator.CreateInstance(t, newHandle);

            MiniServer.AddTerritory(territory);

            return(newHandle);
        }