public async Task <IActionResult> SingleBlog(int id) { var model = new SinglePostModel(); await model.LoadByIdAsync(id); model.LoadCommentsByBlogIdAsync(id); return(View(model)); }
/// /////////////////////{ end : blog }//////////////////////// /// ////////////////////////{ start : blog_post }////////////////////////6 ////مثال ////url = MS/blog_post?IdPage=1 public ActionResult Blog_Post(int Id) { Blog_ModelFiller BMF = new Blog_ModelFiller(3); var model = new SinglePostModel() { PostModel = BMF.UserPostModels("همه", 1, 0, ""), SPPD = BMF.SinglePostFiller(Id), BlogPicSlider = BMF.GetAllBlogPostPics(Id) }; return(View(model)); }
public async Task <IActionResult> AddComment(SinglePostModel model) { var commentModel = new CommentModel(); commentModel.BlogId = model.Id; commentModel.Name = model.CommenterName; commentModel.Email = model.CommenterEmail; commentModel.Description = model.CommentDescription; try { await commentModel.PostComment(); _logger.LogInformation("Comment Added Successfully"); } catch (Exception ex) { _logger.LogInformation(ex.Message); } return(RedirectToAction("SingleBlog", "Blog", new { @id = model.Id })); }
private void getPostDetails(string id) { Task.Run(async() => { SinglePostModel postModel = await Api.DavinciApi.GetPostDetail(id); VoteModel voteModel = await Api.DavinciApi.GetVoteStatus(id); return(new { p = postModel, v = voteModel }); }).ContinueWith(t => { //set fields headerTextView.Text = "Owner: " + t.Result.p.post.owner.username; detailTextView.Text = "Uploaded at " + t.Result.p.post.createdAt.Split('T')[0]; setVoteButtonState(t.Result.v.vote); ratioBar.SetRatio(t.Result.p.post.LikeRatio); var imageData = Base64.Decode(t.Result.p.post.image, Base64Flags.Default); var bitmap = BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length); imageView.SetImageBitmap(bitmap); }, TaskScheduler.FromCurrentSynchronizationContext()); }