public async Task <int> ThemThongTinGiaoDichKhacNganhang(ThongTinGiaoDichLienNganHangBO thongTinGiaoDichLienNganHang) { var result = 0; var config = new MapperConfiguration(cfg => { cfg.CreateMap <ThongTinGiaoDichLienNganHangBO, ThongTinGiaoDichLienNganHangDO>(); }); var mapper = config.CreateMapper(); var addParam = mapper.Map <ThongTinGiaoDichLienNganHangDO>(thongTinGiaoDichLienNganHang); using (DalSession dal = new DalSession()) { try { dal.UnitOfWork.Begin(); result = await dal.UnitOfWork.NganHangLienKetRepository.ThemThongTinGiaoDichKhacNganhang(addParam); dal.UnitOfWork.Commit(); } catch (Exception ex) { dal.UnitOfWork.Rollback(); } return(result); } }
public async Task <IActionResult> LuuGiaoDichKhacNganHang(ThemThongTinGiaoDichKhacNganHangRequest request) { var thongTinGiaoDichLienNganHangBO = new ThongTinGiaoDichLienNganHangBO(); thongTinGiaoDichLienNganHangBO.NgayTao = request.NgayTao; thongTinGiaoDichLienNganHangBO.NoiDung = request.NoiDung; thongTinGiaoDichLienNganHangBO.SoTien = request.SoTien; thongTinGiaoDichLienNganHangBO.SoTKGui = request.SoTKGui; thongTinGiaoDichLienNganHangBO.SoTKNhan = request.SoTKNhan; thongTinGiaoDichLienNganHangBO.TenNganHangGui = request.TenNganHangGui; thongTinGiaoDichLienNganHangBO.TenNganHangNhan = request.TenNganHangNhan; var result = _nganHangLienKetService.ThemThongTinGiaoDichKhacNganhang(thongTinGiaoDichLienNganHangBO); var updateSoDu = _userService.UpdateSoDuGiaoDichKhacNganHang(request.SoTKGui, request.SoTien, false); return(Ok(new { mesError = "request success", status = true })); }
public async Task <IActionResult> GiaoDichChuyenTienAdmin(ThemThongTinGiaoDichKhacNganHangRequest request) { var thongTinGiaoDichLienNganHangBO = new ThongTinGiaoDichLienNganHangBO(); thongTinGiaoDichLienNganHangBO.NgayTao = request.NgayTao; thongTinGiaoDichLienNganHangBO.NoiDung = request.NoiDung; thongTinGiaoDichLienNganHangBO.SoTien = request.SoTien; thongTinGiaoDichLienNganHangBO.SoTKGui = request.SoTKGui; thongTinGiaoDichLienNganHangBO.SoTKNhan = request.SoTKNhan; thongTinGiaoDichLienNganHangBO.TenNganHangGui = request.TenNganHangGui; thongTinGiaoDichLienNganHangBO.TenNganHangNhan = request.TenNganHangNhan; var result = _nganHangLienKetService.ThemThongTinGiaoDichKhacNganhang(thongTinGiaoDichLienNganHangBO); var updateSoDu = _userService.UpdateSoDuGiaoDichKhacNganHang(request.SoTKGui, request.SoTien, false); return(Ok(result)); }
public async Task <IActionResult> GiaoDichKhacNganHang(ThemThongTinGiaoDichKhacNganHangRequest request) { //var nganHang = GetNganHangLienKetByIdOrTenNganHang(-1, request.TenNganHangGui); var nganHang = _nganHangLienKetService.GetNganHangLienKetByIdOrTenNganHang(-1, request.TenNganHangGui); var secretKey = nganHang.Result.SecretKey; var publicKey = nganHang.Result.PublicKey; var thongTinGiaoDichLienNganHangBO = new ThongTinGiaoDichLienNganHangBO(); thongTinGiaoDichLienNganHangBO.NgayTao = request.NgayTao; thongTinGiaoDichLienNganHangBO.NoiDung = request.NoiDung; thongTinGiaoDichLienNganHangBO.SoTien = request.SoTien; thongTinGiaoDichLienNganHangBO.SoTKGui = request.SoTKGui; thongTinGiaoDichLienNganHangBO.SoTKNhan = request.SoTKNhan; thongTinGiaoDichLienNganHangBO.TenNganHangGui = request.TenNganHangGui; thongTinGiaoDichLienNganHangBO.TenNganHangNhan = request.TenNganHangNhan; if (secretKey == "" || secretKey == null || publicKey == "" || publicKey == null) { return(Ok(new { mesError = "request false", status = false })); } else { var verifySignRsa = VerifySignRsa(secretKey, publicKey, request.Signature); if (verifySignRsa) { var result = _nganHangLienKetService.ThemThongTinGiaoDichKhacNganhang(thongTinGiaoDichLienNganHangBO); var updateSoDu = _userService.UpdateSoDuGiaoDichKhacNganHang(request.SoTKNhan, request.SoTien, true); return(Ok(new { mesError = "request success", status = true })); } else { return(Ok(new { mesError = "request false", status = false })); } } }