コード例 #1
0
        public ActionResult <IEnumerable <CheckIn> > GetAllForHomie(int homieId)
        {
            var includes = new Expression <Func <Homie, object> >[] {
                x => x.CheckIns
            };
            var homie = _homieRepo.GetById(homieId, includes);

            if (homie == null)
            {
                return(NotFound());
            }

            return(homie.CheckIns.ToList());
        }
コード例 #2
0
        public ActionResult <Homie> GetById(int id)
        {
            var includes = new Expression <Func <Homie, object> >[] {
                x => x.Location
            };

            var homie = _homieRepo.GetById(id, includes);

            if (homie == null)
            {
                return(NotFound());
            }

            return(homie);
        }
コード例 #3
0
        public IActionResult AddHomie(int id, int homieId)
        {
            var includes = new Expression <Func <Location, object> >[] {
                x => x.Homies
            };

            var location = _locationRepo.GetById(id, includes);

            if (location == null)
            {
                return(NotFound());
            }

            var homie = _homieRepo.GetById(homieId);

            if (homie == null)
            {
                return(NotFound());
            }

            location.Homies.Add(homie);
            _locationRepo.Edit(location);

            return(NoContent());
        }