Esempio n. 1
0
        public string GetActivityNumber()
        {
            int number = Measurements.Count() + DietPlans.Count() + WorkoutPlans.Count();

            if (number != 0)
            {
                return(Login + " " + number.ToString());
            }
            else
            {
                return(Login + " " + "NEAKTIVNI");
            }
        }
        public static DietPlans POCOObjToEntity(POCO.DietPlan dietPlan)
        {
            if (dietPlan == null)
            {
                return(null);
            }

            var d = new DietPlans
            {
                Id          = dietPlan.Id,
                Name        = dietPlan.Name,
                Information = dietPlan.Information,
                PersonId    = dietPlan.PersonId
            };

            return(d);
        }
        public static POCO.DietPlan DietPlanEntityObjToPOCO(DietPlans entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dietPlan = new POCO.DietPlan
            {
                Id          = entity.Id,
                Name        = entity.Name,
                Information = entity.Information,
                PersonId    = entity.PersonId,
                Creator     = PersonEntityToPOCO(entity.Person),
                Meals       = getMealList(entity.Meals)
            };

            return(dietPlan);
        }
        public POCO.DietPlan create(POCO.DietPlan dietPlan)
        {
            if (dietPlan == null)
            {
                throw new ArgumentNullException();
            }

            if (string.IsNullOrEmpty(dietPlan.Name) || dietPlan.PersonId <= 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            var d = new DietPlans
            {
                Name        = dietPlan.Name,
                Information = dietPlan.Information,
                PersonId    = dietPlan.PersonId
            };

            d           = _genericAccess.Add(d);
            dietPlan.Id = d.Id;
            return(dietPlan);
        }