public IActionResult Create(Tile cliente) { _tileService.Create(cliente); return(CreatedAtRoute("", new { id = cliente.Id.ToString() }, cliente)); }
public async Task <ActionResult> Create([FromForm(Name = "files")] IFormFile imgs) { if (imgs == null) { return(NotFound()); } Tile tile = new Tile() { }; var fileInfo = imgs.ContentDisposition; var pattern = @"\d+(?=.)"; List <string> index = new List <string>(); string fullName = ""; foreach (Match match in Regex.Matches(fileInfo, pattern)) { fullName = match.Value; index.Add(fullName); } if (index.Count < 3) { return(Ok("输入文件夹层级错误")); } else { tile.z = index[index.Count - 1]; tile.y = index[index.Count - 2]; tile.x = index[index.Count - 3]; } BinaryReader binaryReader = new BinaryReader(imgs.OpenReadStream()); tile.img = binaryReader.ReadBytes(Convert.ToInt32(imgs.Length)); return(Ok(await _tileService.Create(tile))); }
public async Task <Tile> Create(Tile tile) { return(await _tileService.Create(tile)); }