示例#1
0
        public ActionResult <Child> GetChildById(int childId)
        {
            Child child = childDao.GetChildById(childId, userId);

            if (child == null)
            {
                return(Forbid());
            }

            List <Parent>  parents   = parentDao.GetParentsByChild(childId, userId);
            List <Allergy> allergies = allergyDao.GetAllergiesByChildId(child.ChildId);

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

            return(Ok(child));
        }
示例#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));
        }