Пример #1
0
        public ActionResult addSP(string aoe, string aMaSp, string aMaLoai, string atenSp, string ahangSp, int aGia, string amanHinh, string aheDieuhanh, string aCpu, string acamTr, string acamSau, string aRam, string aboNho, string aSim, string aPin, string atrangThai, HttpPostedFileBase aAnh)
        {
            SanPham dt = new SanPham();

            dt.maSp        = aMaSp;
            dt.maLoaiDt    = aMaLoai;
            dt.tenSp       = atenSp;
            dt.hangSp      = ahangSp;
            dt.gia         = aGia;
            dt.manHinh     = amanHinh;
            dt.heDieuhanh  = aheDieuhanh;
            dt.CPU         = aCpu;
            dt.cameraTruoc = acamTr;
            dt.cameraSau   = acamSau;
            dt.RAM         = aRam;
            dt.boNho       = aboNho;
            dt.Sim         = aSim;
            dt.Pin         = aPin;
            dt.trangThai   = atrangThai;
            if (aAnh.ContentLength > 0)
            {
                string path = Server.MapPath("~/Assets/anh") + "/" + aAnh.FileName;
                aAnh.SaveAs(path);
                dt.hinhAnh = aAnh.FileName;
            }
            if (aoe == "1")
            {
                sp.createDT(dt);
            }
            else
            {
                sp.editOneNV(dt);
            }

            return(Redirect("~/Admin/SanPham"));
        }