public bool addComment(BinhLuan binhLuan) { try { db.BinhLuan.Add(binhLuan); db.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
private CommentViewModels BinhLuan2ViewModels(BinhLuan p) { CommentViewModels result = new CommentViewModels(); result.datePost = (DateTime) p.NgayDang; result.content = p.NoiDung; AccountBus acBus = new AccountBus(); ThanhVien temp = acBus.getMemberByUserId(p.MS_ThanhVien.ToString()); result.url_Avatar = temp.Avatar; result.fullName = temp.HoTen; result.IDPost = p.MS_BaiNhanXet.ToString(); return result; }
internal CommentViewModels addComment(string CommentContent, string IDPost, string IDUser) { CommentViewModels result = new CommentViewModels(); ReviewFilmsBus reviewBus = new ReviewFilmsBus(); BinhLuan binhLuan = new BinhLuan(); binhLuan.MS_BaiNhanXet = Int32.Parse(IDPost); binhLuan.MS_ThanhVien = IDUser; binhLuan.NoiDung = CommentContent; binhLuan.NgayDang = System.DateTime.Now; if(reviewBus.addComment(binhLuan)) { result = BinhLuan2ViewModels(binhLuan); } return result; }
public bool addComment(BinhLuan binhLuan) { try { db.BinhLuan.Add(binhLuan); db.SaveChanges(); return true; } catch (Exception e) { return false; } }