/// <summary> /// Get all the departments from db /// </summary> /// <returns></returns> public async Task <List <DepartmentVM> > GetDepartments() { //PlantData plantData = new PlantData(_db, _adapter); List <DepartmentVM> departments = _adapter .ConvertToTListFromU <DepartmentVM, DepartmentModel>(await GetDepartmentList()); PlantVM plant = new PlantVM(); foreach (var item in departments) { plant.PlantId = item.PlantId; item.Plant = _plantData.GetPlants(plant).GetAwaiter().GetResult().FirstOrDefault(); } return(departments); }
/// <summary> /// Get all the plants from db /// </summary> /// <returns>List of plants VM</returns> public async Task <List <PlantVM> > GetPlants() { var plants = _adapter.ConvertToTListFromU <PlantVM, PlantModel>(await GetPlantList()); return(plants); }