Пример #1
0
        private Model.PersonalPlant ConvertPersonalPlant(PersonalPlant plant)
        {
            if (plant != null)
            {
                Model.PersonalPlant mPP = new Model.PersonalPlant
                {
                    Id          = plant.id,
                    PId         = plant.pid,
                    AId         = plant.aid,
                    NName       = plant.nname,
                    LastWatered = plant.lastwatered,
                    NextWatered = plant.nextwatered,
                    WDuration   = plant.wduration,

                    account = ConvertAccount(plant.Account),
                    plant   = ConvertPlant(plant.Plant)
                };

                return(mPP);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// Find a single personal plant via PersonalPlant ID
        /// </summary>
        /// <param name="ppID">PersonalPlant ID</param>
        /// <returns>Returns the personal plant with the correct PersonalPlantID,
        ///  or it will return null if nothing is find.</returns>
        public Model.PersonalPlant FindPersonalPlant(int ppID)
        {
            /*PersonalPlant result = null;
             * foreach (PersonalPlant pp in stubPPDB.personalPlants)
             * {
             *  if (pp.Id == ppID)
             *  {
             *      result = pp;
             *      break;
             *  }
             * }*/

            var pp = accrepo.FindPersonalPlant(ppID);

            Model.PersonalPlant result = ConvertPersonalPlant(pp);

            return(result);
        }