예제 #1
0
        public async Task <ActionResult <AssetViewModel> > AddAsset([FromBody] AssetCreateModel createModel)
        {
            UserViewModel user = await GetCurrentUserAsync();

            if (user == null)
            {
                return(HandleUserNotFoundResult());
            }

            AssetViewModel result = await _assetService.AddAssetAsync(user.Id, createModel);

            return(HandleResult(result));
        }
예제 #2
0
        public void CreateDummyAssets()
        {
            var assetList = new List <Asset>()
            {
                new Asset()
                {
                    Title       = "Enchanted Forest",
                    Description = @"Mysterious forest spritesheet. Created as infinitely scalable vector art in Illustrator and setup in Unity.
        - Includes 24 tileable blocks for quickly drawing levels using tilemaps. Blocks can be setup to use Unity Rule tiles for correct alignment and rotation of the blocks. 
        - 35 environment objects such as trees, bushes, mushrooms, vines, rocks, flowers, lights and a boat
        - Parallax background which repeats horizontally and is already setup in Unity with all the required scripts",
                    Price       = 14.99m,
                    Images      = new List <ImagePath>()
                    {
                        new ImagePath()
                        {
                            Name      = "Enchanted Forest",
                            ImageType = ImageType.Preview,
                            Path      = @"/images/bg1.png"
                        },
                        new ImagePath()
                        {
                            Name      = "Enchanted Forest Main",
                            ImageType = ImageType.Main,
                            Path      = @"/images/efmain.png"
                        },
                        new ImagePath()
                        {
                            Name      = "Enchanted Forest Spritesheet",
                            ImageType = ImageType.Side,
                            Path      = @"/images/enchanted_nv.png"
                        },
                        new ImagePath()
                        {
                            Name      = "Enchanted Forest a65",
                            ImageType = ImageType.Bottom,
                            Path      = @"/images/Artboard 65.png"
                        },
                        new ImagePath()
                        {
                            Name      = "Enchanted Forest a73",
                            ImageType = ImageType.Bottom,
                            Path      = @"/images/Artboard 73.png"
                        },
                        new ImagePath()
                        {
                            Name      = "Enchanted Forest 60",
                            ImageType = ImageType.Bottom,
                            Path      = @"/images/Artboard 60.png"
                        }
                    }
                },
                new Asset()
                {
                    Title       = "Low Poly",
                    Description = "Low poly land for 3d worlds",
                    Price       = 14.99m,
                    Images      = new List <ImagePath>()
                    {
                        new ImagePath()
                        {
                            Name      = "Low Poly Land",
                            ImageType = ImageType.Preview,
                            Path      = @"/images/bg3.png"
                        }
                    }
                },
                new Asset()
                {
                    Title       = "Red Moon District",
                    Description = "Crow in sunset",
                    Price       = 11.49m,
                    Images      = new List <ImagePath>()
                    {
                        new ImagePath()
                        {
                            Name      = "Red Moon",
                            ImageType = ImageType.Preview,
                            Path      = @"/images/bg2.png"
                        }
                    }
                },
                new Asset()
                {
                    Title       = "Mystical Flower",
                    Description = "Enchanted Forest Addon",
                    Price       = 3.49m,
                    Images      = new List <ImagePath>()
                    {
                        new ImagePath()
                        {
                            Name      = "Flower",
                            ImageType = ImageType.Preview,
                            Path      = @"/images/Flower1.png"
                        }
                    }
                },
                new Asset()
                {
                    Title       = "Crystal Cave",
                    Description = "Stalagmitic cave pack",
                    Price       = 5.49m,
                    Images      = new List <ImagePath>()
                    {
                        new ImagePath()
                        {
                            Name      = "Crystal cave",
                            ImageType = ImageType.Preview,
                            Path      = @"/images/Artboard 68.png"
                        }
                    }
                },
                new Asset()
                {
                    Title       = "Water Park",
                    Description = "Shark infested water pack",
                    Price       = 7.49m,
                    Images      = new List <ImagePath>()
                    {
                        new ImagePath()
                        {
                            Name      = "Shark Water",
                            ImageType = ImageType.Preview,
                            Path      = @"/images/Artboard 57.png"
                        }
                    }
                },
            };

            foreach (var item in assetList)
            {
                try
                {
                    _ = assetService.AddAssetAsync(item).Result;
                }
                catch (Exception ex)
                {
                    continue;
                }
            }
        }