Exemplo n.º 1
0
    public int AddToFavourites(string type, string WebID)
    {
        member = (Member)HttpContext.Current.Session["Member"];
        CommentType contentType = (CommentType)Enum.Parse(typeof(CommentType), type);

        Favourite favourite = new Favourite();

        favourite.MemberID = member.MemberID;
        favourite.TheFavouriteObjectID = GetObjectID(contentType, WebID);
        favourite.ObjectType = (int)contentType;
        favourite.DTCreated = DateTime.Now;
        favourite.SaveWithCheck();

        return 1;
    }
        private static void MarkAsFovorite(data.Comment comment)
        {
            Debug.Assert(comment != null, "comment != null");

            switch (comment.CommentType)
            {
                case 1:
                case 2:
                    {
                        var favorite = new Favourite()
                        {
                            MemberID = comment.MemberIDFrom,
                            TheFavouriteObjectID = comment.ObjectID,
                            ObjectType = comment.CommentType,
                            DTCreated = DateTime.Now
                        };
                        favorite.SaveWithCheck();
                        break;
                    }
            }
        }