Beispiel #1
0
        public async Task <IActionResult> PutSortie(int id, Sortie sortie)
        {
            if (id != sortie.Id)
            {
                return(BadRequest());
            }

            _context.Entry(sortie).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SortieExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
 public Employee UpdateEmployee(Employee dbemployee, Employee employee)
 {
     dbemployee.RemainingCongeSolde = employee.RemainingCongeSolde;
     _context.Entry(employee).State = EntityState.Modified;
     _context.SaveChangesAsync();
     return(dbemployee);
 }
Beispiel #3
0
        public Sortie UpdateSortie(Sortie dbSortie, Sortie sortie)
        {
            dbSortie.SortieState           = sortie.SortieState;
            _context.Entry(dbSortie).State = EntityState.Modified;
            _context.SaveChanges();

            return(dbSortie);
        }
        public Conge UpdateConge(Conge conge, Conge inputConge)
        {
            conge.CongeState = inputConge.CongeState;
            if (conge.CongeState == CongeState.APPROVED)

            {
                var date1     = conge.start_Date;
                var date2     = conge.end_Date;
                var sub       = date2.Subtract(date1);
                int empId     = conge.EmployeeId;
                int remaining = _context.Employees.Where(x => x.Id == conge.EmployeeId).Select(x => x.RemainingCongeSolde).First();
                remaining     = remaining - sub.Days;
                remainingSold = remaining;
            }


            _context.Entry(conge).State = EntityState.Modified;
            _context.SaveChanges();
            return(conge);
        }