public PastureBaseViewModel GetPastureViewModel(int marketingYearId) { IList <PastureDto> pastureDtos = _pastureDao.GetByMarketingYear(marketingYearId); List <PastureViewModel> pastureViewModels = pastureDtos.Select(x => new PastureViewModel { Id = x.Id, Section = x.Section, District = x.District, Forestry = x.Forestry, Description = x.Description, CreatedDate = x.CreatedDate, RemovedDate = x.RemovedDate }).ToList(); MarketingYearModel marketingYearModel = _marketingYearService.GetMarketingYearModel(marketingYearId); AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId); var pastureBaseViewModel = new PastureBaseViewModel { PastureViewModels = pastureViewModels, MarketingYearModel = marketingYearModel, AnnualPlanStatusModel = annualPlanStatusModel }; return(pastureBaseViewModel); }
public ActionResult List(int marketingYearId) { PastureBaseViewModel pastureBaseViewModel = _pastureService.GetPastureViewModel(marketingYearId); return(View(pastureBaseViewModel)); }