コード例 #1
0
        public List <ShiftControlModel> FirstEmployeesHours(int shift)
        {
            var electedShift = repoShift.Read(shift);

            var listEmployee = repoEmployees.ReadAll().Where(c => c.CurrentShift.ID == shift);

            var listModel = new List <ShiftControlModel>();

            var shiftcontrol = new ShiftControlModel();

            if (listEmployee != null)
            {
                foreach (var x in listEmployee)
                {
                    var shifttData = new ShiftControl
                    {
                        Employee = x,
                        Day      = DateTime.Today
                    };

                    repoControl.Create(shifttData);

                    var auxEmployee = new EmployeeModel();

                    if (x != null)
                    {
                        auxEmployee = new ConvertEmployee().ConvertModel(x);
                    }

                    listModel.Add(new ShiftControlModel()
                    {
                        ID       = repoControl.Read(DateTime.Today, x.ID).ID,
                        Employee = auxEmployee,
                        Day      = DateTime.Today,
                    });
                }
            }

            return(listModel);
        }
コード例 #2
0
        public List <EmployeeModel> ReadAll()
        {
            var listemployee = repoEmployees.ReadAll();

            var listModel = new List <EmployeeModel>();

            foreach (var employee in listemployee)
            {
                listModel.Add(new ConvertEmployee().ConvertModel(employee));
            }

            return(listModel);
        }