public ActionResult DangKy(FormCollection f)
        {
            NguoiDungDAO nd   = new NguoiDungDAO();
            NguoiDung    user = new NguoiDung();

            user.TaiKhoan = f["user"];
            user.Email    = f["email"];
            user.MatKhau  = f["pass"];
            if (nd.Login(user.TaiKhoan, user.MatKhau))
            {
            }
            else
            {
                nd.AddNew(user);
                Session["taikhoan"] = user;
            }
            return(RedirectToAction("Index", "NguoiDung"));
        }
        public ActionResult AddNew(NguoiDung obj, HttpPostedFileBase file)
        {
            int id = dao.AddNew(obj);

            if (file.ContentLength > 0)
            {
                string fileName = Path.GetFileNameWithoutExtension(file.FileName);
                fileName += "_" + obj.IdNguoiDung;
                fileName += Path.GetExtension(file.FileName);

                string folderPath = Server.MapPath("~") + @"\Assets\images\NguoiDung";


                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }

                string path = Path.Combine(folderPath, fileName);


                file.SaveAs(path);

                obj.AnhDaiDien = fileName;
                if (id != -1)
                {
                    return(RedirectToAction("Index", "NguoiDung"));
                }
                else
                {
                    ViewBag.Message("Them moi khong thanh cong");
                    return(RedirectToAction("AddNew", "NguoiDung"));
                }
            }
            return(View());
        }