public ActionResult CapGiayChungNhan([Bind(Include = "id,name")] thutuc thutuc, HttpPostedFileBase file)
        {
            var thongtin             = db.loaithutucs.ToList();
            List <loaithutuc> listID = new List <loaithutuc>();

            for (int i = 0; i < thongtin.Count; i++)
            {
                if (thongtin[i].loai != Constants.CAPGIAYCHUNGNHAN)
                {
                    listID.Add(thongtin[i]);
                }
            }
            foreach (loaithutuc item in listID)
            {
                thongtin.Remove(item);
            }

            if (ModelState.IsValid)
            {
                //thutuc.ngaytao = DateTime.Today;
                // thutuc.anh = "khongco";

                db.thutucs.Add(thutuc);


                db.SaveChanges();
                thutuc = db.thutucs.OrderByDescending(u => u.id).FirstOrDefault();
                var chitietthutuc = new chitietthutuc();
                for (int i = 0; i < thongtin.Count; i++)
                {
                    chitietthutuc         = new chitietthutuc();
                    chitietthutuc.noidung = Request.Form["thutucname" + i];
                    chitietthutuc.value   = Request.Form["thutuc" + i];
                    chitietthutuc.thutuc  = thutuc.id;
                    db.chitietthutucs.Add(chitietthutuc);
                }

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

            // ViewBag.id_user = new SelectList(db.users, "id", "username", thutuc.id_user);
            return(View(thutuc));
        }
        public ActionResult CapNhatThongTin([Bind(Include = "id, name")] thutuc thutuc, HttpPostedFileBase file)
        {
            var thongtin             = db.loaithutucs.ToList();
            List <loaithutuc> listID = new List <loaithutuc>();

            for (int i = 0; i < thongtin.Count; i++)
            {
                if (thongtin[i].loai != Constants.CAPNHATTHONGTIN)
                {
                    listID.Add(thongtin[i]);
                }
            }
            foreach (loaithutuc item in listID)
            {
                thongtin.Remove(item);
            }

            if (ModelState.IsValid)
            {
                //thutuc.ngaytao = DateTime.Today;
                // thutuc.anh = "khongco";

                db.thutucs.Add(thutuc);


                db.SaveChanges();
                thutuc = db.thutucs.OrderByDescending(u => u.id).FirstOrDefault();
                var chitietthutuc = new chitietthutuc();
                for (int i = 0; i < thongtin.Count; i++)
                {
                    chitietthutuc         = new chitietthutuc();
                    chitietthutuc.noidung = Request.Form["thutucname" + i];
                    chitietthutuc.value   = Request.Form["thutuc" + i];
                    chitietthutuc.thutuc  = thutuc.id;
                    db.chitietthutucs.Add(chitietthutuc);
                }

                db.SaveChanges();
            }
            return(View(thutuc));
        }