public async Task <IActionResult> Edit([FromForm] EditBlogCommand command) { command.LoginUserId = ClientUser.UUID; var cmdResult = await _mediator.Send(command); return(Ok(cmdResult)); }
public ActionResult Edit(EditBlogViewModel vm) { if (!ModelState.IsValid) { return(View(vm)); } EditBlogCommand command = new EditBlogCommand { Id = vm.Id, Title = vm.Title, PreviewContent = vm.PreviewContent, HtmlContent = vm.HtmlContent, IsPublished = vm.IsPublished }; if (vm.Image != null) { var result = SaveAs(vm.Image, PlatformConfiguration.UploadedBlogPath); if (result.ResultCode == CommandResultCode.Success && result.File != null) { command.FileId = result.File.Id; } } Command.Execute(command); return(RedirectToAction("Details", new { id = vm.Id })); }