public ActionResult Create([Bind(Include = "CategoryId,ParentId,ChildId,CategoryName,OrderNo,Status,UserId")] Danhmuc danhmuc)
        {
            if (ModelState.IsValid)
            {
                db.Danhmucs.Add(danhmuc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(danhmuc));
        }
        public ActionResult Create([Bind(Include = "UserId,Username,Password,Fullname,Email,Avatar,isAdmin,Allowed")] Nguoidung nguoidung)
        {
            if (ModelState.IsValid)
            {
                db.Nguoidungs.Add(nguoidung);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(nguoidung));
        }
예제 #3
0
        public void UpdateViewNo(int id)
        {
            var find = db.Tintucs.Find(id);

            find.ViewNo = find.ViewNo + 1;
            db.SaveChanges();
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "BlogId,Title,Brief,Content,Picture,CreateDate,CategoryId,CategoryChildId,Tags,ViewNo,Status,UserId,Seotitle")] Tintuc tintuc)
        {
            if (ModelState.IsValid)
            {
                tintuc.CreateDate = DateTime.Now;
                db.Tintucs.Add(tintuc);

                tintuc.ViewNo = 0;
                db.Tintucs.Add(tintuc);

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tintuc));
        }