public IActionResult AddPostPhoto(IFormFile img, long postId) { if (img == null) { return(RedirectToActionPermanent("PostWith", "Post", new { postId = postId })); } var ms = new MemoryStream(); img.CopyTo(ms); mediaService.AddPostPhoto(ms, postId); return(RedirectToActionPermanent("PostWith", "Post", new { postId = postId })); }