public async Task <ActionResult> Create([Bind(Include = "ID,TENKH,GMAIL")] DSKHACHHANG dSKHACHHANG)
        {
            if (ModelState.IsValid)
            {
                db.DSKHACHHANGs.Add(dSKHACHHANG);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(dSKHACHHANG));
        }
        public async Task <ActionResult> Create([Bind(Include = "ID,SOTHUTU,HINHANH")] PHOTO pHOTO)
        {
            if (ModelState.IsValid)
            {
                db.Photos.Add(pHOTO);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(pHOTO));
        }
Example #3
0
        public async Task <ActionResult> Create([Bind(Include = "IDTAIKHOAN,PASS")] TAIKHOAN tAIKHOAN)
        {
            if (ModelState.IsValid)
            {
                db.TAIKHOANs.Add(tAIKHOAN);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(tAIKHOAN));
        }
Example #4
0
        public async Task <ActionResult> Create([Bind(Include = "ID,IDTHELOAI,TIEUDE,NOIDUNGPHU,HINHANH,NOIDUNGCHINH,NGAYTHANG")] TINTUC tINTUC)
        {
            if (ModelState.IsValid)
            {
                db.TINTUCs.Add(tINTUC);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.IDTHELOAI = new SelectList(db.THELOAITINTUCs, "IDTHELOAI", "TENTHELOAI", tINTUC.IDTHELOAI);
            return(View(tINTUC));
        }
        public async Task <ActionResult> NHANTHONGTIN([Bind(Include = "ID,TENKH,GMAIL")] DSKHACHHANG dSKHACHHANG)
        {
            dSKHACHHANG.ID = getGUID().ToString();
            if (ModelState.IsValid)
            {
                db.DSKHACHHANGs.Add(dSKHACHHANG);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(dSKHACHHANG));
        }
        public async Task <ActionResult> THUVIENADD([Bind(Include = "ID,IDTHELOAI,HINHANH,HINHANHFile")] THUVIENANH tHUVIENANH)
        {
            ViewBag.IDTHELOAI = new SelectList(db.THELOAITHUVIENs, "IDTHELOAI", "THELOAIANH", tHUVIENANH.IDTHELOAI);
            string fileName  = Path.GetFileNameWithoutExtension(tHUVIENANH.HINHANHFile.FileName);
            string extension = Path.GetExtension(tHUVIENANH.HINHANHFile.FileName);

            fileName           = fileName + DateTime.Now.ToString("yymmssfff") + extension;
            tHUVIENANH.HINHANH = fileName;
            fileName           = Path.Combine(Server.MapPath("~/ContentWebmaster/img/"), fileName);
            tHUVIENANH.HINHANHFile.SaveAs(fileName);
            tHUVIENANH.ID = getGUID().ToString();
            if (ModelState.IsValid)
            {
                db.THUVIENANHs.Add(tHUVIENANH);
                await db.SaveChangesAsync();

                return(RedirectToAction("THUVIENVIEW"));
            }

            return(View(tHUVIENANH));
        }