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()); }
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); }
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()); }