public async Task <IActionResult> SavePost([FromForm] PostViewModel viewModel)
        {
            var postOptionsViewModel = _jsonParsePostOptionDefaultVm.ToObject(viewModel.PostOptionsViewModel);

            viewModel.PostOptionsDefaultViewModel = postOptionsViewModel;

            if (viewModel.Id.HasValue)
            {
                await _postRepository.EditPost(viewModel);
            }
            else
            {
                await _postRepository.SavePost(viewModel);
            }

            return(Ok());
        }
        public async Task <IActionResult> SavePost([FromForm] PostViewModel viewModel)
        {
            var postOptionsViewModel = _jsonParsePostOptionDefaultVm.ToObject(viewModel.PostOptionsViewModel);

            viewModel.PostOptionsDefaultViewModel = postOptionsViewModel;

            if (viewModel.Id.HasValue)
            {
                await _postRepository.EditPost(viewModel);
            }
            else
            {
                var path = Path.Combine(
                    Directory.GetCurrentDirectory(), "wwwroot\\assets",
                    viewModel.Thumbnail.GetFilename());
                using (var stream = new FileStream(path, FileMode.Create))
                {
                    await viewModel.Thumbnail.CopyToAsync(stream);
                }
                await _postRepository.SavePost(viewModel);
            }

            return(Ok());
        }