public async Task <ActionResult <IEnumerable <PrProductTaskDtos> > > GetPPT(string year, string month, int?id) { var data = _IMapper.Map <IEnumerable <PrProductTaskDtos> >((await _IPrProductTaskService.Search(t => true)).ToList()); foreach (var item in data) { item.ProductName = (await _IPrProductService.FindAsyncById((int)item.ProductId)).Name; item.ProductUnit = (await _IPrProductService.FindAsyncById((int)item.ProductId)).Unit; item.DepartmentName = (await _IAcDepartmentService.FindAsyncById((int)item.DepartmentId)).Name; item.OperatorName = (await _IAcStaffService.FindAsyncById((int)item.OperatorId)).Name; } if (year != "" && year != null) { data = data.Where(d => ((DateTime)d.ProductDate).ToString("yyyy") == year).ToList(); } if (month != "" && month != null) { data = data.Where(d => ((DateTime)d.ProductDate).ToString("MM") == month).ToList(); } if (id != null) { data = data.Where(d => d.Id == id).ToList(); } return(data.ToList()); }
public async Task <AcStaff> GetStaffInfo(int id) { return(await _IAcStaffService.FindAsyncById(id));; }