コード例 #1
0
        //Remove Absence by Id
        public void remove(int id)
        {
            var obj = _context.ABSENCE.Find(id);

            _context.ABSENCE.Remove(obj);

            //Confirm Alter
            _context.SaveChanges();
        }
コード例 #2
0
        //Method to insert Incharger
        public void Insert(Incharge incharge)
        {
            int lastId = _context.INCHARGE.Select(obj => obj.ID).Last(); //Load last incharge Id

            //Increment new Incharge id to the last one
            incharge.IncrementId(lastId);

            _context.Add(incharge); //Add new incharge
            _context.SaveChanges(); //Save changes
        }
コード例 #3
0
        //Method to insert Loan
        public void Insert(Loan loan)
        {
            //int lastId = _context.LOAN.Select(obj => obj.ID).Last(); //Load last loan Id

            //Increment new Loan id to the last one
            loan.IncrementId();

            _context.Add(loan);     //Add new loan
            _context.SaveChanges(); //Save changes
        }
コード例 #4
0
        //Method to insert Team
        public void Insert(Team team)
        {
            int lastId = _context.TEAM.Select(obj => obj.ID).Last(); //Load last incharge Id

            //Increment new Team id to the last one
            team.IncrementId(lastId);

            _context.Add(team);     //Add new team
            _context.SaveChanges(); //Save changes
        }
コード例 #5
0
        //Method to insert new Schedule
        public void Insert(Schedule schedule)
        {
            int lastId = _context.SCHEDULE.Select(obj => obj.ID).Last(); //Load last Schedule Id

            //Increment new Team id to the last one
            schedule.IncrementId(lastId);

            _context.Add(schedule); //Add new team
            _context.SaveChanges(); //Save changes
        }
コード例 #6
0
        //Method to insert Employee
        public void Insert(Employee employee)
        {
            int lastId = _context.EMPLOYS.Select(obj => obj.ID).Last(); //Load last Employee Id

            //Increment new employee id to the last one
            employee.IncrementId(lastId);

            _context.Add(employee); //Add new employee
            _context.SaveChanges(); //Save changes
        }
コード例 #7
0
        //Method to insert Presence
        public void Insert(Presence presence)
        {
            int lastId = _context.PRESENCE.Select(obj => obj.ID).Last(); //Load last presence Id

            //Increment new Presence id to the last one

            presence.IncrementId(lastId);

            _context.Add(presence); //Add new presence
            _context.SaveChanges(); //Save changes
        }
コード例 #8
0
        //Metodo para inserir novo utilizador
        public void Insert(User user)
        {
            int lastId = _context.USERS.Select(obj => obj.ID).Last();//Load Last Id

            //Increment new user id to the last one
            user.IncrementId(lastId);

            //Add new object
            _context.Add(user);

            //Save changes
            _context.SaveChanges();
        }
コード例 #9
0
        //Update Loans
        public void Update(LoanForEmploy obj)
        {
            //Test if id exists
            if (!_context.LOAN_FOR_EMPLOY.Any(x => x.ID == obj.ID))
            {
                throw new NotFoundException("Id not Found");
            }

            //Update Loan
            _context.Update(obj);

            //Save changes
            _context.SaveChanges();
        }