public ActionResult AjaxDelFav(int TargetId, string Type) { Maticsoft.BLL.SNS.UserFavourite favourite = new Maticsoft.BLL.SNS.UserFavourite(); if (favourite.DeleteEx(base.currentUser.UserID, TargetId, (Type == "Product") ? 1 : 0)) { return base.Content("True"); } return base.Content("False"); }
public ActionResult AjaxAddFavourite(FormCollection Fm) { int postId = Globals.SafeInt(Fm["TargetId"], 0); if (Fm["Type"] == "Video") { Maticsoft.BLL.SNS.Posts posts = new Maticsoft.BLL.SNS.Posts(); if (posts.UpdateFavCount(postId)) { return base.Content("Ok"); } return base.Content("No"); } Maticsoft.Model.SNS.UserFavourite favModel = new Maticsoft.Model.SNS.UserFavourite(); Maticsoft.BLL.SNS.UserFavourite favourite2 = new Maticsoft.BLL.SNS.UserFavourite(); int topicId = Globals.SafeInt(Fm["TopicId"], 0); int replyId = Globals.SafeInt(Fm["ReplyId"], 0); favModel.Type = (Fm["Type"] == "Product") ? 1 : 0; favModel.TargetID = Globals.SafeInt(Fm["TargetId"], 0); favModel.CreatedDate = DateTime.Now; favModel.CreatedUserID = base.currentUser.UserID; favModel.CreatedNickName = base.currentUser.NickName; if (favourite2.Exists(base.currentUser.UserID, favModel.Type, favModel.TargetID)) { return base.Content("Repeat"); } if (favourite2.AddEx(favModel, topicId, replyId)) { return base.Content("Ok"); } return base.Content("No"); }