public LaborBaseViewModel GetLaborViewModel(int marketingYearId) { IList <LaborDto> laborDtos = _laborDao.GetByMarketingYear(marketingYearId); IList <HuntsmanDto> huntsmanDtos = _huntsmanDao.GetAll(); List <LaborViewModel> laborViewModels = ( from labor in laborDtos join huntsman in huntsmanDtos on labor.HuntsmanId equals huntsman.Id select new LaborViewModel { Id = labor.Id, HuntsmanId = huntsman.Id, HuntsmanName = $"{huntsman.Name} {huntsman.LastName}", Description = labor.Description, Date = labor.Date } ).ToList(); MarketingYearModel marketingYearModel = _marketingYearService.GetMarketingYearModel(marketingYearId); AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId); var laborBaseViewModel = new LaborBaseViewModel { LaborViewModels = laborViewModels, MarketingYearModel = marketingYearModel, AnnualPlanStatusModel = annualPlanStatusModel }; return(laborBaseViewModel); }
public ActionResult List(int marketingYearId) { LaborBaseViewModel laborBaseViewModel = _laborService.GetLaborViewModel(marketingYearId); return(View(laborBaseViewModel)); }