public int DatPhongMoi(Bang_DS_DatPhong ma) { ma.NgayDat = DateTime.Now; ma.TinhTrang = "Dang Cho"; db.Bang_DS_DatPhongs.Add(ma); db.SaveChanges(); return(ma.MaDatPhong); }
public bool ThemMoi(DonHang ma) { try { db.DonHangs.Add(ma); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public int ThemThongTinKhach(Bang_DS_DatPhong thongTin) { List <KhachHang> TimKiemKhachTheoSDT = db.KhachHangs.Where(x => x.SDT == thongTin.SDT).ToList(); if (TimKiemKhachTheoSDT.Count != 0) { var TimPhieuDatPhong = db.Bang_DS_DatPhongs.Find(thongTin.MaDatPhong); TimPhieuDatPhong.TinhTrang = "Success"; db.SaveChanges(); return(TimKiemKhachTheoSDT[0].MaKhachHang); } else { KhachHang bienTam = new KhachHang(); bienTam.TenKhachHang = thongTin.HoTen; bienTam.SDT = thongTin.SDT; bienTam.GioiTinh = thongTin.GioiTinh; bienTam.DiaChi = thongTin.DiaChi; bienTam.Email = thongTin.Email; db.KhachHangs.Add(bienTam); db.SaveChanges(); var TimPhieuDatPhong = db.Bang_DS_DatPhongs.Find(thongTin.MaDatPhong); TimPhieuDatPhong.TinhTrang = "Success"; db.SaveChanges(); return(bienTam.MaKhachHang); } }
public bool Add(CT_DatPhong ma) { try { db.CT_DatPhong.Add(ma); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public int ThemMoi(CT_NhapHang ma) { try { db.CT_NhapHang.Add(ma); db.SaveChanges(); return(ma.STT); } catch (Exception ex) { return(-1); } }
public bool Add(ChiTietDonHang ma) { try { db.ChiTietDonHangs.Add(ma); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public int ThemMoi(ChiTietHangHoa ma) { try { var tim = TimKiem(ma.MaKho, ma.MaHang); if (tim != null) { tim.Soluong = tim.Soluong + ma.Soluong; tim.DonGia = ma.DonGia; db.SaveChanges(); return(0); } else { db.ChiTietHangHoas.Add(ma); db.SaveChanges(); return(1); } } catch (Exception ex) { return(-1); } }
public ActionResult DangKy([Bind(Include = "MaKhachHang,TenKhachHang,SDT,DiaChi,GioiTinh,Email")] KhachHang KhachHang) { if (ModelState.IsValid) { if (db.KhachHangs.Find(KhachHang.MaKhachHang) == null) { db.KhachHangs.Add(KhachHang); db.SaveChanges(); Session["KH"] = KhachHang; return(RedirectToAction("HomeKH", "Index")); } else { ModelState.AddModelError("", "Tên tài khoản đã được sử dụng !"); } } return(View(KhachHang)); }
public int ThemMoi(QuyenHan ma) { db.QuyenHans.Add(ma); db.SaveChanges(); return(ma.MaQuyenHan); }
public int ThemMoi(KhachSan ma) { db.KhachSans.Add(ma); db.SaveChanges(); return(ma.MaKhachSan); }
public int ThemMoi(NhaCungCap ma) { db.NhaCungCaps.Add(ma); db.SaveChanges(); return(ma.MaNhaCungCap); }
public int ThemMoi(HangHoa ma) { db.HangHoas.Add(ma); db.SaveChanges(); return(ma.MaHang); }
public int ThemMoi(KhuyenMai ma) { db.KhuyenMais.Add(ma); db.SaveChanges(); return(ma.MaKhuyenMai); }
public int ThemMoi(LoaiPhong ma) { db.LoaiPhongs.Add(ma); db.SaveChanges(); return(ma.MaLoaiPhong); }
public int ThemMoi(QuanLyKhoHang ma) { db.QuanLyKhoHangs.Add(ma); db.SaveChanges(); return(ma.STT); }
public int ThemMoi(KhachHang ma) { db.KhachHangs.Add(ma); db.SaveChanges(); return(ma.MaKhachHang); }
public int ThemMoi(DS_XuatKho ma) { db.DS_XuatKho.Add(ma); db.SaveChanges(); return(ma.MaHangXuatKho); }
public int ThemMoi(ChiTiet_QuyenHan ma) { db.ChiTiet_QuyenHan.Add(ma); db.SaveChanges(); return(ma.MaQuyenHan); }
public int ThemMoi(DichVu ma) { db.DichVus.Add(ma); db.SaveChanges(); return(ma.MaDichVu); }
public int ThemMoi(PhongKhachSan ma) { db.PhongKhachSans.Add(ma); db.SaveChanges(); return(ma.MaPhong); }
public string ThemMoi(DanhSachNguoiDung ma) { db.DanhSachNguoiDungs.Add(ma); db.SaveChanges(); return(ma.MaNguoiDung); }