public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var count = 0; var repo = new KhachHangRepository(context); for (int i = 0; i < _listId.Count; i++) { if (_listId[i] > 0 && await repo.Delete(_listId[i])) { count++; InsertLuocSuAction ls = new InsertLuocSuAction(); ls.InsertLuocSu(context, "ListKhachHang", _listId[i], "Delete", 0); } } return(returnActionResult(HttpStatusCode.OK, count, null)); } catch (FormatException ex) { return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public AuthController(KhachHangRepository khachHangRepository, JWTService jWTService, IOptions <AuthSettings> authSettings, AccountRepository accountRepository) : base() { this.khachHangRepository = khachHangRepository; this.jWTService = jWTService; this.authSettings = authSettings.Value; this.accountRepository = accountRepository; }
public async Task <dynamic> Execute(ContextDto context) { try { dynamic result = new System.Dynamic.ExpandoObject(); var repo = new KhachHangRepository(context); await repo.UpdatePartial(this, nameof(Ma), nameof(Ten), nameof(Loai), nameof(DienThoai), nameof(DiDong), nameof(Email), nameof(DiaChi), nameof(TinhThanhPhoId), nameof(QuanHuyenId), nameof(PhuongXaId), nameof(AnyDesk) ); result.data = this; InsertLuocSuAction ls = new InsertLuocSuAction(); ls.InsertLuocSu(context, "KhachHang", KhachHangId, "Update", 0); return(returnActionResult(this, null)); } catch (FormatException ex) { return(returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.Message)); } }
public DoanhNghiepController(DoanhNghiepRepository doanhNghiepRepository, DoanhNghiepService doanhNghiepService, AccountRepository accountRepository, KhachHangRepository khachHangRepository, ThanhPhoService thanhPhoService, DiaChiRepository diaChiRepository) { this.doanhNghiepRepository = doanhNghiepRepository; this.doanhNghiepService = doanhNghiepService; this.accountRepository = accountRepository; this.khachHangRepository = khachHangRepository; this.thanhPhoService = thanhPhoService; this.diaChiRepository = diaChiRepository; }
public UnitOfWork(QLNHContext context) { this.context = context; ThucDons = new ThucDonRepository(context); BanAns = new BanAnRepository(context); HoaDons = new HoaDonRepository(context); LoaiMonAns = new LoaiMonAnRepository(context); KhachHangs = new KhachHangRepository(context); PhieuDatBans = new PhieuDatBanRepository(context); NguoiDungs = new NguoiDungRepository(context); }
public UnitOfWork(IDbContextFactory <DoAnDbContext> dbContextFactory, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor) {//2 _dbContext = dbContextFactory.GetContext(); DanhSachPhongRepository = new DanhSachPhongRepository(_dbContext); DuThuyenRepository = new DuThuyenRepository(_dbContext); HangPhongRepository = new HangPhongRepository(_dbContext); KhachHangRepository = new KhachHangRepository(_dbContext); KieuGiuongRepository = new KieuGiuongRepository(_dbContext); NhomPhongRepository = new NhomPhongRepository(_dbContext); PhieuDatChiTietRepository = new PhieuDatChiTietRepository(_dbContext); PhieuDatPhongRepository = new PhieuDatPhongRepository(_dbContext); }
public async Task <ActionResultDto> Execute(ContextDto context) { try { var khachhang = new Entity.MSSQL_QLDN_QLNS.Entity.KhachHang(); khachhang.Ma = Ma; khachhang.Ten = Ten; khachhang.Loai = Protector.Short(Loai); khachhang.DienThoai = DienThoai; khachhang.DiDong = DiDong; khachhang.Email = Email; khachhang.DiaChi = DiaChi; khachhang.TinhThanhPhoId = Protector.Short(Tinh); khachhang.QuanHuyenId = Protector.Short(Huyen); khachhang.PhuongXaId = Protector.Short(Xa); khachhang.AnyDesk = AnyDesk; khachhang.NgayTao = DateTime.Now; khachhang.NguoiTao = 1; khachhang.XoaYN = "N"; khachhang.CtrVersion = 1; KhachHangRepository repo = new KhachHangRepository(context); await repo.Insert(khachhang); InsertLuocSuAction ls = new InsertLuocSuAction(); ls.InsertLuocSu(context, "KhachHang", khachhang.KhachHangId, "Insert", 0); return(returnActionResult(HttpStatusCode.OK, khachhang, null)); } catch (FormatException ex) { return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public KhachHangController(KhachHangRepository khachHangRepository) { this.khachHangRepository = khachHangRepository; }
public KhachHangBUL() { khdal = new KhachHangRepository(); }