コード例 #1
0
        public string GetActivityNumber()
        {
            int number = Measurements.Count() + DietPlans.Count() + WorkoutPlans.Count();

            if (number != 0)
            {
                return(Login + " " + number.ToString());
            }
            else
            {
                return(Login + " " + "NEAKTIVNI");
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }