コード例 #1
0
 public JsonResult getDanhSachNguoiDung(NguoiTaoPhieu nguoitaophieu)
 {
     var data = ThuChiobj.NguoiTaoPhieus.Where(g => g.Id == nguoitaophieu.Id).Select(c => new { Id = c.Id, Ten = c.Ten, DiaChi = c.DiaChi, Email = c.Email, SoDienThoai = c.SoDienThoai, LoaiNguoiTaoPhieuId = c.LoaiNguoiTaoPhieuId }).FirstOrDefault();
     return Json(data, JsonRequestBehavior.AllowGet);
 }
コード例 #2
0
 public string TaoNhaCungCap(NguoiTaoPhieu nhacungcap)
 {
     if (ModelState.IsValid)
     {
         nhacungcap.LoaiNguoiTaoPhieuId = 3;
         ThuChiobj.NguoiTaoPhieus.Add(nhacungcap);
         ThuChiobj.SaveChanges();
         return "Thanh cong";
     }
     return "Khong thanh cong";
 }
コード例 #3
0
 public string TaoNhanVien(NguoiTaoPhieu nhanvien)
 {
     if (ModelState.IsValid)
     {
         nhanvien.LoaiNguoiTaoPhieuId = 1;
         ThuChiobj.NguoiTaoPhieus.Add(nhanvien);
         ThuChiobj.SaveChanges();
         return "Thanh cong";
     }
     return "Khong thanh cong";
 }
コード例 #4
0
 public string TaoKhachHang(NguoiTaoPhieu khachhang)
 {
     if (ModelState.IsValid)
     {
         khachhang.LoaiNguoiTaoPhieuId = 2;
         ThuChiobj.NguoiTaoPhieus.Add(khachhang);
         ThuChiobj.SaveChanges();
         return "Thanh cong";
     }
     return "Khong thanh cong";
 }
コード例 #5
0
 public string SuaNhanVien(NguoiTaoPhieu nhanvien, int Id)
 {
     NguoiTaoPhieu nv = ThuChiobj.NguoiTaoPhieus.Find(Id);
     if (ModelState.IsValid)
     {
         nv.LoaiNguoiTaoPhieuId = 1;
         nv.Ten = nhanvien.Ten;
         nv.SoDienThoai = nhanvien.SoDienThoai;
         nv.Email = nhanvien.Email;
         nv.DiaChi = nhanvien.DiaChi;
         ThuChiobj.Entry(nv).State = EntityState.Modified;
         ThuChiobj.SaveChanges();
         return "A";
     }
     return "B";
 }
コード例 #6
0
 public string SuaNhaCungCap(NguoiTaoPhieu nhacungcap, int Id)
 {
     NguoiTaoPhieu ncc = ThuChiobj.NguoiTaoPhieus.Find(Id);
     if (ModelState.IsValid)
     {
         ncc.LoaiNguoiTaoPhieuId = 1;
         ncc.Ten = nhacungcap.Ten;
         ncc.SoDienThoai = nhacungcap.SoDienThoai;
         ncc.Email = nhacungcap.Email;
         ncc.DiaChi = nhacungcap.DiaChi;
         ThuChiobj.Entry(ncc).State = EntityState.Modified;
         ThuChiobj.SaveChanges();
         return "A";
     }
     return "B";
 }
コード例 #7
0
 public string SuaKhachHang(NguoiTaoPhieu khachhang, int Id)
 {
     NguoiTaoPhieu kh = ThuChiobj.NguoiTaoPhieus.Find(Id);
     if (ModelState.IsValid)
     {
         kh.LoaiNguoiTaoPhieuId = 2;
         kh.Ten = khachhang.Ten;
         kh.SoDienThoai = khachhang.SoDienThoai;
         kh.Email = khachhang.Email;
         kh.DiaChi = khachhang.DiaChi;
         ThuChiobj.Entry(kh).State = EntityState.Modified;
         ThuChiobj.SaveChanges();
         return "A";
     }
     return "B";
 }
コード例 #8
0
 public string SuaKhac(NguoiTaoPhieu khac, int Id)
 {
     NguoiTaoPhieu kc = ThuChiobj.NguoiTaoPhieus.Find(Id);
     if( ModelState.IsValid)
     {
         kc.LoaiNguoiTaoPhieuId = 4;
         kc.Ten = khac.Ten;
         kc.SoDienThoai = khac.SoDienThoai;
         kc.Email = khac.Email;
         kc.DiaChi = khac.DiaChi;
         ThuChiobj.Entry(kc).State = EntityState.Modified;
         ThuChiobj.SaveChanges();
         return "A";
     }
     return "B";
 }