public IActionResult UpdateBanner([FromBody] Post post) { if (ModelState.IsValid) { var model = _postAppService.UpdatePost(post); return(Ok(model)); } return(NotFound()); }
public async Task <IActionResult> UpdatePost([FromForm] UpdatePost input) { try { await _postAppService.UpdatePost(input); return(Ok("Created Tenant")); } catch (Exception e) { Console.WriteLine(e); throw; } }
public async Task <IActionResult> OnPostAsync() { if (ModelState.IsValid) { string uniqueFileName = null; if (UpdatedPostDto.PhotoFile != null) { uniqueFileName = Guid.NewGuid().ToString() + "_" + UpdatedPostDto.PhotoFile.FileName; var filePath = Path.Combine(hostingEnvironment.WebRootPath + "/imgs", uniqueFileName); UpdatedPostDto.PhotoFile.CopyTo(new FileStream(filePath, FileMode.Create)); UpdatedPostDto.PhotoPath = uniqueFileName; } flag = await postService.UpdatePost(UpdatedPostDto); } return(RedirectToPage("/Post/PostList")); }