public void UpdateDisLike(A_Like tblLike) { if (tblLike.LikeFlag != 0) { tblLike.LikeFlag = 0; } else { tblLike.LikeFlag = 2; } tblLike.UpdateTime = DateTime.Now; db.Entry(tblLike).State = EntityState.Modified; db.SaveChanges(); }
public void Insert(A_Like tblLike) { if (HttpContext.Current.Session["UserId"] == null) { tblLike.UserId = Settings.Default.TrialUserId; } else { tblLike.UserId = int.Parse(HttpContext.Current.Session["UserId"].ToString()); } tblLike.ActiveFlag = 1; tblLike.CreateTime = DateTime.Now; tblLike.UpdateTime = DateTime.Now; db.A_Like.Add(tblLike); db.SaveChanges(); }
public void setDisLike(long senMeanId) { LikeDao lkDao = new LikeDao(); A_Like sTblLike = lkDao.getLstLike(senMeanId); if (sTblLike == null) { lkDao.Insert(new A_Like() { SenMeanId = senMeanId, LikeFlag = 0 }); } else { lkDao.UpdateDisLike(sTblLike); } }