public void DeletePlantFromPlantGroup(string gardenName, string plantGroupName, string plantName, string accountID)
        {
            if (string.IsNullOrEmpty(gardenName))
            {
                throw new ArgumentException("message", nameof(gardenName));
            }

            if (string.IsNullOrEmpty(plantGroupName))
            {
                throw new ArgumentException("message", nameof(plantGroupName));
            }

            if (string.IsNullOrEmpty(plantName))
            {
                throw new ArgumentException("message", nameof(plantName));
            }

            Garden garden = GardenRepository.GetByName(gardenName, accountID);

            PlantGroup plantGroup = PlantGroupRepository.GetByName(plantGroupName, accountID);

            Plant plant = PlantRepository.GetByName(plantName);

            //Not sure this is needed?
            plantGroup.DeletePlant(plant);
            PlantGroupRepository.DeletePlantFromPlantGroup(plantGroup, plant, accountID);
        }
        public void AddPlantToPlantGroup(string gardenName, string plantGroupName, string plantName, string accountID)
        {
            if (string.IsNullOrEmpty(gardenName))
            {
                throw new ArgumentException("message", nameof(gardenName));
            }

            if (string.IsNullOrEmpty(plantGroupName))
            {
                throw new ArgumentException("message", nameof(plantGroupName));
            }

            if (string.IsNullOrEmpty(plantName))
            {
                throw new ArgumentException("message", nameof(plantName));
            }

            Garden garden = GardenRepository.GetByName(gardenName, accountID);

            PlantGroup plantGroup = PlantGroupRepository.GetByName(plantGroupName, accountID);

            Plant plant = PlantRepository.GetByName(plantName);

            plantGroup.AddPlant(plant);
            PlantGroupRepository.AddPlantToPlantGroup(plantGroup, plant, accountID); //should be update
        }
        public ActionResult <(string, string)> GetIncompatibilities(string plantGroupName, string plantName, string accountID)
        {
            var plantGroup = PlantGroupRepository.GetByName(plantGroupName, accountID);

            if (plantGroup == null)
            {
                return(NotFound());
            }
            var plant = PlantRepository.GetByName(plantName);

            if (plant == null)
            {
                return(NotFound());
            }
            List <(Plant, List <IPlantRequirement>)> requirementList = plantGroup.GetAllIncompatibilities(plant);

            List <(string, string)> expandedList = new List <(string, string)>();

            foreach ((Plant, List <IPlantRequirement>)reqPair in requirementList)
            {
                foreach (IPlantRequirement req in reqPair.Item2)
                {
                    expandedList.Add((reqPair.Item1.Name, req.TypeOfReq()));
                }
            }
            return(Ok(expandedList));
        }
        public ActionResult <PlantGroup> GetPlantGroupByName(string name, string accountID)
        {
            var plantGroup = PlantGroupRepository.GetByName(name, accountID);

            if (plantGroup != null)
            {
                return(plantGroup);
            }
            return(NotFound());
        }
        public void DeletePlantGroup(string gardenName, string plantGroupName, string accountID)
        {
            if (string.IsNullOrEmpty(gardenName))
            {
                throw new ArgumentException("message", nameof(gardenName));
            }

            if (plantGroupName == null)
            {
                throw new ArgumentNullException(nameof(plantGroupName));
            }

            Garden     garden     = GardenRepository.GetByName(gardenName, accountID);
            PlantGroup plantGroup = PlantGroupRepository.GetByName(plantGroupName, accountID);

            PlantGroupRepository.DeletePlantGroup(garden, plantGroup, accountID);
        }
        public void RemoveHardwareFromPlantGroup(string accountID, string plantGroupName, string hardwareID)
        {
            if (string.IsNullOrEmpty(accountID))
            {
                throw new ArgumentException("message", nameof(accountID));
            }

            if (plantGroupName == null)
            {
                throw new ArgumentNullException(nameof(plantGroupName));
            }

            if (hardwareID == null)
            {
                throw new ArgumentNullException(nameof(hardwareID));
            }
            PlantGroupRepository.RemoveHardwareFromPlantGroup(accountID, plantGroupName, hardwareID);
        }
        public void CreatePlantGroup(string gardenName, string plantGroupName, string accountID)
        {
            if (string.IsNullOrEmpty(gardenName))
            {
                throw new ArgumentException("message", nameof(gardenName));
            }

            if (plantGroupName == null)
            {
                throw new ArgumentNullException(nameof(plantGroupName));
            }

            Garden garden = GardenRepository.GetByName(gardenName, accountID);

            PlantGroup plantGroup = new PlantGroup(plantGroupName);

            PlantGroupRepository.CreatePlantGroup(garden, plantGroup, accountID);

            garden.AddPlantGroup(plantGroup);
            GardenRepository.AddPlantGroup(garden, plantGroup, accountID); //should be update
        }
 public ActionResult <List <List <string> > > GetAllHardware(string accountID)
 {
     return(PlantGroupRepository.GetAllHardware(accountID));
 }