public async Task <ActionResult> XuatLuong(XuatLuongCuoiThangVM model)
        {
            var phieuChi_luongCuoiThang = new PhieuChi_LuongCuoiThang
            {
                MaPhieuChi           = Guid.NewGuid().ToString(),
                MaNhanVienXuatLuong  = model.MaNhanVienXuatLuong,
                ThoiGianXuatPhieuChi = DateTime.Now
            };
            bool isCreatedSuccess = await phieuChi_LuongCuoiThangRepository.Create(phieuChi_luongCuoiThang);

            if (!isCreatedSuccess)
            {
                ModelState.AddModelError("", "Error while creating record on PhieuChi_LuongCuoiThang database table ");
                return(View(model));
            }

            var nhatKyLamViecs = await nhatKylamViecRepository.FindByMaNhanVienAndThangTinhLuong(model.MaNhanVienDuocXuatLuong, model.ThangTinhLuong, model.NamTinhLuong);

            foreach (var nhatky in nhatKyLamViecs)
            {
                var phieuChi_NKLVRecord = new PhieuChi_NKLV
                {
                    MaPhieuChi          = phieuChi_luongCuoiThang.MaPhieuChi,
                    MaNhanVien_NKLV     = nhatky.MaNhanVien,
                    ThoiGianBatDau_NKLV = nhatky.ThoiGianBatDau,
                    ID = Guid.NewGuid().ToString()
                };
                var isCreatePhieuChi_NKLVRecordSuccess = await phieuChi_NKLVRepository.Create(phieuChi_NKLVRecord);

                if (!isCreatePhieuChi_NKLVRecordSuccess)
                {
                    ModelState.AddModelError("", "Error while creating record on PhieuChi_NKLV database table");
                    return(View(model));
                }
            }
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <bool> Create(PhieuChi_NKLV entity)
        {
            await db.PhieuChi_NKLVs.AddAsync(entity);

            return(await Save());
        }
 public async Task <bool> Delete(PhieuChi_NKLV entity)
 {
     db.PhieuChi_NKLVs.Remove(entity);
     return(await Save());
 }
 public async Task <bool> Update(PhieuChi_NKLV entity)
 {
     db.PhieuChi_NKLVs.Update(entity);
     return(await Save());
 }