示例#1
0
        public async Task <int> Update(KHEditRequest request)
        {
            var maKH = await _context.KhachHangs.FindAsync(request.MaKH);

            var khachHang = await _context.KhachHangs.FirstOrDefaultAsync(x => x.MaKH == request.MaKH);

            if (khachHang == null)
            {
                throw new EkGisException($"Khong tim thay khach hang: {request.MaKH}");
            }

            khachHang.TenKH    = request.TenKH;
            khachHang.DiaChi   = request.DiaChi;
            khachHang.Email    = request.Email;
            khachHang.NgaySinh = request.NgaySinh;
            khachHang.SDT      = request.SDT;

            return(await _context.SaveChangesAsync());
        }
示例#2
0
        public async Task <IActionResult> Update(KHEditRequest request)
        {
            var result = await _khachHangService.Update(request);

            return(Ok(result));
        }