//加关注 public string jiaguan(U_Attention_U uau) { uau.User1ID = Convert.ToInt32(Request["guanzhuzheid"]); uau.User2ID = Convert.ToInt32(Request["beiguanzhuid"]); uau.Time = DateTime.Now; attention.addattention(uau); return("关注成功"); }
public bool deleteattention(int guanzhuzheid, int beiguanzhuid) { U_Attention_U attention = db.U_Attention_U.Where(b => b.User1ID == guanzhuzheid && b.User2ID == beiguanzhuid).FirstOrDefault(); if (attention != null) { db.U_Attention_U.Remove(attention); db.SaveChanges(); return(true); } else { return(false); } }
public string ifattention(int guanzhuzheid, int beiguanzhuid) { U_Attention_U attention = db.U_Attention_U.Where(a => a.User1ID == guanzhuzheid && a.User2ID == beiguanzhuid).FirstOrDefault(); if (attention != null) { //不为空表示已经关注 return("取消关注"); } else if (guanzhuzheid == beiguanzhuid) { //表示为自己 return("进入个人中心"); } else { return("加关注"); } }
//加关注 public void addattention(U_Attention_U attention) { iattention.addattention(attention); }
public void addattention(U_Attention_U attention) { db.U_Attention_U.Add(attention); db.SaveChanges(); }