public SeedlingDTO GetSeedlingById(int id) { using (var context = new PlantAppContext()) { return(context.Seedlings.Where(x => x.Id == id).ToList().Select(x => SeedlingDTO.FromEntity(x)).FirstOrDefault()); } }
public List <SeedlingDTO> GetAllSeedlings() { using (var context = new PlantAppContext()) { var seedlings = context.Seedlings.ToList().Select(x => SeedlingDTO.FromEntity(x)).ToList(); return(seedlings); } }