public async Task <IActionResult> UploadImage(IFormFile file)
        {
            string fileName;
            string path;

            try
            {
                fileName = file.FileName;
                path     = Path.Combine(Directory.GetCurrentDirectory(), $"wwwroot//media");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, fileName);

                using (var bits = new FileStream(path, FileMode.Create))
                {
                    await file.CopyToAsync(bits);
                }
                var fileModel = new FileModel {
                    Filename = fileName, FilePath = "/media/" + fileName
                };
                _repository.AddFile(fileModel);
                _repository.SaveChanges();
                var fileReadDto = _mapper.Map <FileReadDto>(fileModel);
                return(CreatedAtRoute(nameof(GetFileById), new { Id = fileReadDto.Id }, fileReadDto));
            }
            catch
            {
                return(BadRequest("Failed to save image"));
            }
        }
        public async Task <IActionResult> Post([FromForm] FileViewModel data)
        {
            Files file = new Files();

            file.File   = data.File;
            file.NoteId = data.NoteId;

            await _fileService.AddFile(file);

            return(NotFound());
        }