static void Main(string[] args) { FileBase fb = new FileBase(); Console.WriteLine(fb.GetMonth()); FooFile ff = new FooFile(); Console.WriteLine(ff.GetMonth()); Console.ReadLine(); }
public async Task <IActionResult> PostFile([FromForm] FooFile foo) { using (var memoryStream = new MemoryStream()) { await foo.File.OpenReadStream().CopyToAsync(memoryStream); var fileName = Guid.NewGuid().ToString("N"); var path = Path.Combine(Path.GetTempPath(), fileName); await System.IO.File.WriteAllBytesAsync(path, memoryStream.ToArray()); } var response = await _service.Create(foo); return(CreatedAtRoute("getById", new { id = response }, response)); }