Example #1
0
        public Comment(AdvertismentComment comment)
        {
            this.CommentID      = comment.CommentID;
            this.Message        = comment.Message;
            this.CreateDate     = comment.CreateDate;
            this.AdvertismentID = comment.AdvertismentID;

            this.Login = comment.Login;
            this.User  = new User(comment.User);
        }
        public ActionResult AddComment(string message, int advertismentID)
        {
            var dataModel = new DataModel();

            var commentDB = new AdvertismentComment()
            {
                CommentID      = Guid.NewGuid(),
                AdvertismentID = advertismentID,
                CreateDate     = SystemUtils.Utils.Date.GetUkranianDateTimeNow(),
                UserID         = SystemUtils.Authorization.UserID,
                Login          = SystemUtils.Authorization.Login,
                Message        = message
            };

            dataModel.AdvertismentComments.InsertOnSubmit(commentDB);
            dataModel.SubmitChanges();

            var comment = new SiteMVC.Models.ModelInterlayerObjects.Comment(commentDB);

            return(Json(comment));
        }