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)); }
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)); }
// 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); }
// 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"); } }