public ActionResult Create([Bind(Include = "maphim,matheloai,daodien,tenphim,ngaykhoichieu,ngayketthuc,mota,hinh,nhasanxuat,thoiluong,trailer")] Phim phim) { try { if (ModelState.IsValid) { //db.Phims.Add(phim); db.Database.SqlQuery <Phim> ("exec sp_addPhim {0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", phim.matheloai.ToString(), phim.daodien.ToString(), phim.tenphim.ToString(), phim.ngaykhoichieu, phim.ngayketthuc, phim.mota.ToString(), phim.hinh.ToString(), phim.nhasanxuat.ToString(), phim.thoiluong.ToString(), phim.trailer.ToString()).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } ViewBag.matheloai = new SelectList(db.TheLoai, "matheloai", "tentheloai", phim.matheloai); return(View(phim)); }
public ActionResult Create([Bind(Include = "mave,masuatchieu,makhachhang,giave,tinhtrang,giodat,maloaive,makm")] VeDangDat veDangDat) { if (ModelState.IsValid) { db.VeDangDat.Add(veDangDat); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(veDangDat)); }
public ActionResult Create([Bind(Include = "makhachhang,ho,tenlot,ten,ngaysinh,gioitinh,sonha,tenduong,quan,thanhpho,dienthoai,email,matkhau")] KhachHang khachHang) { try { if (ModelState.IsValid) { db.Database.SqlQuery <KhachHang>("exec sp_addKhachHang {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", khachHang.ho.ToString(), khachHang.tenlot.ToString(), khachHang.ten.ToString(), khachHang.ngaysinh, khachHang.gioitinh.ToString(), khachHang.sonha.ToString(), khachHang.tenduong.ToString(), khachHang.quan.ToString(), khachHang.thanhpho.ToString(), khachHang.dienthoai.ToString(), khachHang.email.ToString(), khachHang.matkhau.ToString()).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } return(View(khachHang)); }
public ActionResult Create([Bind(Include = "maloaive,tenloaive,giave")] LoaiVe loaiVe) { try { if (ModelState.IsValid) { //db.LoaiVes.Add(loaiVe); db.Database.SqlQuery <LoaiVe>("exec sp_addLoaiVe {0},{1}", loaiVe.tenloaive, loaiVe.giave).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } return(View(loaiVe)); }
public ActionResult Create([Bind(Include = "manv,taikhoan,matkhau,vaitro")] NhanVien nhanVien) { try { if (ModelState.IsValid) { //db.NhanViens.Add(nhanVien); db.Database.SqlQuery <NhanVien>("exec sp_addNhanVien {0},{1},{2}", nhanVien.taikhoan, nhanVien.matkhau, nhanVien.vaitro).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } return(View(nhanVien)); }
public ActionResult Create([Bind(Include = "matheloai,tentheloai")] TheLoai theLoai) { try { if (ModelState.IsValid) { db.Database.SqlQuery <TheLoai>("exec sp_addTheLoai {0}", theLoai.tentheloai).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } return(View(theLoai)); }
public ActionResult Create([Bind(Include = "maphong,tenphong,soghebandau")] PhongChieu phongChieu) { try { if (ModelState.IsValid) { //db.PhongChieux.Add(phongChieu); db.Database.SqlQuery <PhongChieu>("exec sp_addPhongChieu {0}", phongChieu.tenphong).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } return(View(phongChieu)); }
public ActionResult Create([Bind(Include = "masuatchieu,maphim,maphong,giochieu,gioketthuc,ngaychieu,soghecontrong")] SuatChieu suatChieu) { try { if (ModelState.IsValid) { //db.SuatChieux.Add(suatChieu);sp_addSuatChieu //var maphim = db.Phims.Where(s => s.tenphim.Equals(suatChieu.maphim)).Single(); //var maphong = db.PhongChieux.Where(s => s.tenphong.Equals(suatChieu.maphong)).Single(); db.Database.SqlQuery <SuatChieu>("exec sp_addSuatChieu {0}, {1}, {2}, {3}", suatChieu.maphim, suatChieu.maphong, suatChieu.giochieu, suatChieu.ngaychieu).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } return(View(suatChieu)); }
public ActionResult Edit([Bind(Include = "makm,ngaybatdau,ngayketthuc,giatri,tinhtrang")] KhuyenMai khuyenMai) { try { if (ModelState.IsValid) { //db.Entry(khuyenMai).State = EntityState.Modified; db.Database.SqlQuery <KhuyenMai>("exec sp_editKhuyenMai {0},{1},{2},{3},{4}", khuyenMai.makm, khuyenMai.ngaybatdau, khuyenMai.ngayketthuc, khuyenMai.giatri, khuyenMai.tinhtrang).ToList(); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (EntityCommandExecutionException ex) { return(RedirectToAction("Index")); } return(View(khuyenMai)); }