public JsonResult AddOrRemoveLike(int targetId, bool liked) { User model = GetProperty(SessionVariableNames.Current_User) as User; if (model == null && Request.Cookies["UserMail"] != null) { string emailId = Request.Cookies["UserMail"].Value; model = DALayer.GetUserInfo(emailId); } bool matched = DALayer.AddOrRemoveLike(model.UserId, targetId, liked); if (liked) { model.Likes.Add(targetId.ToString()); } else { model.Likes.Remove(targetId.ToString()); } if (matched) { model.Matches.Add(targetId.ToString()); } return(Json(matched, JsonRequestBehavior.AllowGet)); }