Esempio n. 1
0
 public List <ControlLoan> GetAllControlLoanEquipment(int idTypeEquipment, EStatusControlLoan status)
 {
     return(_context.ControlLoan
            .Include("Company")
            .Include("Equipment")
            .Include("Equipment.TypeEquipment")
            .Where(ControlLoanSpecs.GetEquipmentControlLoan(idTypeEquipment, status))
            .OrderBy(x => x.IdControlLoan).ToList());
 }
Esempio n. 2
0
 public List <ControlLoan> GetByRange(int skip, int take, string word, EStatusControlLoan status)
 {
     return(_context.ControlLoan
            .Include("Company")
            .Include("Equipment")
            .Include("Equipment.TypeEquipment")
            .Where(ControlLoanSpecs.GetSearchControlLoan(word, status))
            .OrderBy(x => x.IdControlLoan).Skip((skip - 1) * take).Take(take).ToList());
 }
Esempio n. 3
0
 public int GetCount(string word, EStatusControlLoan status)
 {
     return(_context.ControlLoan.Where(ControlLoanSpecs.GetSearchControlLoan(word, status)).Count());
 }
        public List <Equipment> GetAllEquipmentControlLoan(string word, EStatusEquipment statusEquipment, EStatusControlLoan statusControlLoan)
        {
            List <Equipment> listEquipmentAvailable = new List <Equipment>();


            List <ControlLoan> ControlLoan = (List <ControlLoan>)_context.ControlLoan.Where(ControlLoanSpecs.GetControlLoan(statusControlLoan)).ToList();
            List <Equipment>   Equipment   = _context.Equipment.Where(EquipmentSpecs.GetEquipment(word, statusEquipment)).ToList();

            var joined = ControlLoan.Join(Equipment, controlLoan => controlLoan.IdEquipment, equipment => equipment.IdEquipment, (Person, PersoneType) => new { Name = Person.IdEquipment, TypeID = PersoneType.IdEquipment });

            foreach (var equi in Equipment)
            {
                foreach (var cont in ControlLoan)
                {
                    if (cont.IdEquipment == equi.IdEquipment)
                    {
                        listEquipmentAvailable.Add(equi);
                    }
                }
            }



            //joined.Where(a=>a.Name);
            //var result = _context.Equipment.Join(_context.ControlLoan,)

            //.Include("TypeEquipment")

            //.Where(EquipmentSpecs.GetEquipment(word, status))
            //.OrderBy(x => x.Patrimony).ToList();

            return(listEquipmentAvailable);
        }