Пример #1
0
        public ActionResult <List <Child> > GetAllChildren()
        {
            List <Child> children = childDao.GetChildren(userId);

            foreach (Child child in children)
            {
                List <Parent>  parents   = parentDao.GetParentsByChild(child.ChildId, userId);
                List <Allergy> allergies = allergyDao.GetAllergiesByChildId(child.ChildId);

                child.Parents   = parents;
                child.Allergies = allergies;
            }

            return(Ok(children));
        }
Пример #2
0
        public ActionResult <List <Session> > GetCurrentSessions()
        {
            List <Session> sessions = sessionDao.GetCurrentSessionsByCareTakerId(userId);

            foreach (Session session in sessions)
            {
                session.Child         = childDao.GetChildById(session.ChildId, userId);
                session.Child.Parents = parentDao.GetParentsByChild(session.ChildId, userId);

                session.Diapers = diaperDao.GetAllDiapersBySession(session.SessionId, userId);
                session.Naps    = napDao.GetAllNapsBySession(session.SessionId, userId);
                session.Meals   = mealDao.GetAllMealsBySession(session.SessionId, userId);
            }


            return(Ok(sessions));
        }
Пример #3
0
        public ActionResult <List <Parent> > GetParentsByChild(int childId)
        {
            List <Parent> parents = parentDao.GetParentsByChild(childId, userId);

            if (parents.Count == 0)
            {
                return(NotFound());
            }

            return(parents);
        }