public IActionResult Index() { var _stat = stat.Get(); List <StatModel> statModels = new List <StatModel>(); try { foreach (Statistics a in _stat) { Worker cWorker = workersRepo.Get(a.WorkerID); statModels.Add(new StatModel { WorkerID = cWorker.id, Name = cWorker.Name, Surname = cWorker.Surname, Patronymic = cWorker.Patronymic, StartWork = a.StartWork, EndWork = a.EndWork, Late = a.Late, Latetime = a.Latetime });; } } catch { } if (statModels != null) { return(View(statModels)); } else { return(View()); } }
//get worker stat by him id public IEnumerable <Statistics> GetWorkerStat(int id) { var stat = statRepo.Get(); Worker cWorker = Get(id); var cWorkerStat = stat.Where(a => a.WorkerID == cWorker.id); return(cWorkerStat); }
private IEnumerable <Statistics> CurentDayEnterice(int id) { var Stat = statRepo.Get(); IEnumerable <Statistics> dayStat = null; if (Stat != null || Stat.Any()) { dayStat = Stat.Where(a => a.StartWork.Date.ToString("dd.MM.yyy") == DateTime.Now.ToString("dd.MM.yyy") && a.WorkerID == id); } return(dayStat); }