[HttpGet] /*POSTMAN OK*/
        public IActionResult Get()
        {
            List <LunchDetailed> detailedLunches = _lunchRepo.GetAll().Select(x => x.DaltoDetailedApi()).ToList();

            if (!(detailedLunches is null))
            {
                foreach (LunchDetailed l in detailedLunches)
                {
                    l.Users = _userRepo.GetAllByLunchId(l.Id).Select(x => x.DalToForEntitiesApi());
                    if (l.Users.Count() == 0)
                    {
                        l.Users = null;
                    }
                }
                return(Ok(detailedLunches));
            }
Exemplo n.º 2
0
 public List <LunchModel> GetAll()
 {
     return(lunchRepo.GetAll().ToContracts());
 }