Ejemplo n.º 1
0
        public async Task <IActionResult> Add(WorldAddModel inputModel)
        {
            if (inputModel == null || !ModelState.IsValid)
            {
                return(BadRequest());
            }

            World world;

            if (inputModel.WorldFile == null || inputModel.WorldFile.Count < 1)
            {
                world = await _worldRepository.AddEmpty(inputModel.DisplayName);
            }
            else
            {
                world = await _worldRepository.AddFromZip(inputModel.DisplayName,
                                                          FileUploadHelper.ZipFromFormFile(inputModel.WorldFile.First()));
            }

            return(Ok(world));
        }