public ActionResult Create([Bind(Include = "JournalistId,JournalistFirstName,JournalistLastName,Email,Phone")] Journalist journalist)
        {
            if (ModelState.IsValid)
            {
                db.Journalists.Add(journalist);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(journalist));
        }
        public ActionResult Create([Bind(Include = "journalistId,name,email,phone,address")] Journalist journalist)
        {
            if (ModelState.IsValid)
            {
                db.Journalists.Add(journalist);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(journalist));
        }
        public ActionResult Create([Bind(Include = "articleId,title,content,date,category,journalistId")] Article article)
        {
            if (ModelState.IsValid)
            {
                db.Articles.Add(article);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.journalistId = new SelectList(db.Journalists, "journalistId", "name", article.journalistId);
            return(View(article));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "ArticleID,JournalistID,Tile,Date,Topic")] Article articles)
        {
            if (ModelState.IsValid)
            {
                db.Articles.Add(articles);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.JournalistID = new SelectList(db.Journalists, "JournalistID", "JournalistFirstName", articles.JournalistID);
            return(View(articles));
        }
예제 #5
0
        // hiển thị các comment lab logout end


        // Thêm mới comment vào bài viết start
        protected void btnsubmitcom_Click(object sender, EventArgs e)
        {
            NewsEntities2 db        = new NewsEntities2();
            int           idbaiviet = int.Parse(Request.QueryString["ID_Baiviet"]);
            DateTime      addtime   = DateTime.Now;

            News.Comment obj = new News.Comment();
            obj.Comment1   = addComment.Text;
            obj.ID_BaiViet = int.Parse(Request.QueryString["ID_Baiviet"]);
            obj.Time       = addtime;
            obj.ID_Reader  = 3;
            db.Comment.Add(obj);
            db.SaveChanges();
            Response.Redirect("single_page.aspx?ID_Baiviet=" + idbaiviet);
            //loadlaitrang(idbaiviet);
        }
예제 #6
0
        // Count Bài viết chuyen muc end


        //  Đăng nhập start
        protected void btncreateacount_Click(object sender, EventArgs e)
        {
            NewsEntities2 db = new NewsEntities2();

            News.LoginReader obj = db.LoginReader.FirstOrDefault(x => x.Name == Taikhoan.Text);
            if (obj != null)
            {
                // Cảnh báo mã sản phẩm đã tồn tại
            }
            else
            {
                obj          = new News.LoginReader();
                obj.Name     = Taikhoan.Text;
                obj.Email    = email.Text;
                obj.Password = Password.Text;
                //obj.MaLoai = cmbLoaiSP.SelectedValue;


                db.LoginReader.Add(obj);
                db.SaveChanges();
                Response.Redirect("Content.aspx");
            }
        }