예제 #1
0
        public HttpResponseMessage GetRacksDisponiveis([FromUri] int salaId, int tamanho)
        {
            List <Slot> slots = contexto.Slots
                                .AsNoTracking()
                                .Where(x => x.Sala.Id == salaId)
                                .ToList();

            List <int> slotsId = new List <int>();

            slots.ForEach(x => slotsId.Add(x.Id));

            List <Rack> racks = contexto.Racks
                                .AsNoTracking()
                                .Where(x => slotsId.Contains(x.Slot.Id))
                                .ToList();

            return(Ok(racks.Where(x => ControllerUtils.RackIsDisponivel(contexto, x.Id, tamanho))));
        }