public ActionResult CommentYaz(tbl_comment Comment) { Comment.Tarixi = DateTime.Now; //Comment.Baslig = ""; //Comment.Aktiv = false; db.tbl_comment.Add(Comment); db.SaveChanges(); return(RedirectToAction("PostDetail", new { id = Comment.PostId })); }
public ActionResult Test(Model_video_page obj) { tbl_comment tbl = new tbl_comment(); tbl.login_id = SessionData.UserId; tbl.video_id = obj.mdcomment.video_id; tbl.comment_des = obj.mdcomment.comment_des; tbl.comment_date = DateTime.Today; db.tbl_comments.InsertOnSubmit(tbl); db.SubmitChanges(); return(RedirectToAction("Test")); }
/// <summary> /// 点赞 /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <CommonResultDto <string> > Like(string id) { tbl_comment tbl = await _context.tbl_comment.FirstOrDefaultAsync(i => i.Id == id); if (tbl != null) { ++tbl.LikeTimes; } _context.tbl_comment.Update(tbl); await _context.SaveChangesAsync(); return(new CommonResultDto <string> { Msg = "点赞成功", Success = true }); }
public ActionResult CreateComment(tbl_comment pvm) { List <tbl_product> li = db.tbl_product.ToList(); ViewBag.categorylist = new SelectList(li, "pro_id", "pro_name"); tbl_comment p = new tbl_comment(); p.comment_content = pvm.comment_content; p.comment_fk_pro = pvm.comment_fk_pro; p.comment_fk_user = Convert.ToInt32(Session["u_id"].ToString()); db.tbl_comment.Add(p); db.SaveChanges(); Response.Redirect("index"); return(View()); }
/// <summary> /// 新增评论 /// </summary> /// <param name="dto"></param> /// <returns></returns> public async Task <CommonResultDto <string> > Post(CommentAddDto dto) { tbl_comment tbl = new tbl_comment { Id = Guid.NewGuid().ToString(), BlogId = dto.BlogId, Content = dto.Content, From = dto.From, To = dto.To, CurrentFloorNum = dto.CurrentFloorNum, ToFloorNum = dto.ToFloorNum, CreateAt = DateTime.Now, LikeTimes = 0 }; await _context.tbl_comment.AddAsync(tbl); await _context.SaveChangesAsync(); return(new CommonResultDto <string> { Msg = "新增成功", Success = true }); }
private async void Button_OnClicked(object sender, EventArgs e) { if (entrycomment.Text != null) { var comment = new tbl_comment() { comment = entrycomment.Text, cus_id = user_id, user_id = company_id }; await tbl_comment.Insert(comment); //var profile = (await App.MobileService.GetTable<tbl_Users>().Where(prof => prof.Id == App.user_id).ToListAsync()).FirstOrDefault(); // if (customRattingBar.SelectedStarValue == 1) // { // var users = new tbl_Users() // { // Id = company_id, // first_name = first_name, // last_name = last_name, // email = email, // password = password, // address = address, // contact_number = contact_number, // company_name = company_name, // cover_img = $"{_url}/{_imgId}.jpg", // one_star = star, // two_star = star, // three_star = star, // four_star = star, // five_star = star, // latitude= latitude, // longitude = longitude, // picstr = $"{_imgId}.jpg" // }; // await tbl_Users.Update(users); // } // if (customRattingBar.SelectedStarValue == 2) // { // var users = new tbl_Users() // { // Id = company_id, // first_name = first_name, // last_name = last_name, // email = email, // password = password, // address = address, // contact_number = contact_number, // company_name = company_name, // cover_img = $"{_url}/{_imgId}.jpg", // one_star = star, // two_star = star, // three_star = star, // four_star = star, // five_star = star, // latitude = latitude, // longitude = longitude, // picstr = $"{_imgId}.jpg" // }; // await tbl_Users.Update(users); // } // if (customRattingBar.SelectedStarValue == 3) // { // var users = new tbl_Users() // { // Id = company_id, // first_name = first_name, // last_name = last_name, // email = email, // password = password, // address = address, // contact_number = contact_number, // company_name = company_name, // cover_img = $"{_url}/{_imgId}.jpg", // one_star = star, // two_star = star, // three_star = star, // four_star = star, // five_star = star, // latitude = latitude, // longitude = longitude, // picstr = $"{_imgId}.jpg" // }; // await tbl_Users.Update(users); // } // if (customRattingBar.SelectedStarValue == 4) // { // var users = new tbl_Users() // { // Id = company_id, // first_name = first_name, // last_name = last_name, // email = email, // password = password, // address = address, // contact_number = contact_number, // company_name = company_name, // cover_img = $"{_url}/{_imgId}.jpg", // one_star = star, // two_star = star, // three_star = star, // four_star = star, // five_star = star, // latitude = latitude, // longitude = longitude, // picstr = $"{_imgId}.jpg" // }; // await tbl_Users.Update(users); // } // if (customRattingBar.SelectedStarValue == 5) // { // var users = new tbl_Users() // { // Id = company_id, // first_name = first_name, // last_name = last_name, // email = email, // password = password, // address = address, // contact_number = contact_number, // company_name = company_name, // cover_img = $"{_url}/{_imgId}.jpg", // one_star = star, // two_star = star, // three_star = star, // four_star = star, // five_star = star, // latitude = latitude, // longitude = longitude, // picstr = $"{_imgId}.jpg" // }; //await tbl_Users.Update(users); //} await DisplayAlert("Info", "Your comment has been added!", "OK"); entrycomment.Text = null; await Navigation.PopModalAsync(); } else { await DisplayAlert("Error", "Please leave a comment", "OK"); entrycomment.Focus(); } }