Example #1
0
        public async Task <IActionResult> PutFile()
        {
            try
            {
                var files       = Request.Form.Files[0];
                var description = Request.Form["Description"];

                byte[] resultBytes = new byte[0];
                using (var st = files.OpenReadStream())
                {
                    st.Read(resultBytes);
                    await _exerciseService.AddFile(description, resultBytes);
                }



                return(Ok());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(StatusCode(StatusCodes.Status500InternalServerError, "Произошла ошибка, обратитесь в службу поддержки!"));
            }
        }