Ejemplo n.º 1
0
        public async Task <int> Update(UpdateDinhMucRequest request)
        {
            var chiPhiChucVu = await _context.ChiPhiChucVus.FindAsync(request.MaChiPhi, request.MaCapBac);

            var chucvudf = await _context.ChiPhiChucVus.FirstOrDefaultAsync(x => x.MaCapBac == request.MaCapBac && x.MaChiPhi == request.MaChiPhi);

            if (chiPhiChucVu == null)
            {
                throw new TLUException("Khong co chuc vu");
            }

            chucvudf.SoTienDinhMuc = request.SoTienDinhMuc;
            chucvudf.DonVi         = request.DonVi;
            return(await _context.SaveChangesAsync());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Update([FromBody] UpdateDinhMucRequest request)
        {
            var role = post().RoleID;

            if (role == "RL01" || role == "RL04" || role == "RL05")
            {
                var affecedResult = await _managerChiPhiChucVuService.Update(request);

                if (affecedResult == 0)
                {
                    return(BadRequest());
                }
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }