예제 #1
0
        public ActionResult EditNewsByMember(MemberNewsModels nm)
        {
            if (ModelState.IsValid)
            {
                var x = mns.getMemberNewsById(nm.Id_News, id_M);
                //var x = ns.getNewsById(nm.Id_News);

                /* n.Id_News = nm.Id_News;
                 * n.Id_Member = id_M;
                 * n.date_Of_Comment = new DateTime().Date;
                 * n.Comment = nm.Comment;
                 */
                //n.Comment = Request.Form["commentId"];

                /*n.idNews = nm.idNews;
                 * n.title = nm.title;
                 * n.description = nm.description;
                 * n.picture = nm.picture;
                 * n.admin_id_Member = nm.admin_id_Member;
                 * n.topic_idTopic = nm.topic_idTopic;
                 */

                membernew n = new membernew
                {
                    Id_News         = x.Id_News,
                    Id_Member       = id_M,
                    date_Of_Comment = new DateTime().Date,
                    Comment         = x.Comment
                };


                /*  x.Id_News = nm.Id_News;
                 * x.Id_Member = id_M;
                 * x.date_Of_Comment = new DateTime().Date;
                 * x.Comment = nm.Comment;
                 */
                mns.addMemberNewsById(n);
                // mns.Add(n);
                //    mns.Commit();
            }

            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Create(MemberNewsModels mnm)
        {
            if (ModelState.IsValid)
            {
                //UploadImage();
                membernew mn = new membernew
                {
                    Id_News                   = mnm.Id_News,
                    Id_Member                 = id_M,
                    Comment                   = mnm.Comment,
                    date_Of_Comment           = new DateTime().ToLocalTime(),
                    like_dislike              = mnm.like_dislike,
                    State_News                = 0,
                    title_selected_news       = mnm.title_selected_news,
                    description_selected_news = mnm.description_selected_news
                };
                mns.addMemberNewsById(mn);
                //ns.Add(n);
                //ns.Commit();
            }

            return(RedirectToAction("Index"));
        }