Esempio n. 1
0
        public static EmployeeAbsenceModel ToContract(this Employee_Absence employeeAbsence)
        {
            if (employeeAbsence == null)
            {
                return(null);
            }

            return(new EmployeeAbsenceModel
            {
                Id = employeeAbsence.Id,
                StartDate = employeeAbsence.StartDate,
                EndDate = employeeAbsence.EndDate,
                Employee = employeeAbsence.Employee.ToContract(),
                Absence = employeeAbsence.Absence.ToContract(),
                Removed = employeeAbsence.Removed
            });
        }
Esempio n. 2
0
        public bool Post(Employee_Absence employeeAbsence)
        {
            if (employeeAbsence == null)
            {
                return(false);
            }

            _context.Employee_Absence.AddOrUpdate(employeeAbsence);

            try
            {
                _context.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }