コード例 #1
0
ファイル: ChildrenController.cs プロジェクト: bt93/nanny_app
        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
ファイル: SessionsController.cs プロジェクト: bt93/nanny_app
        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));
        }