예제 #1
0
        public MainResponse GetClassExhibitors(int ClassId)
        {
            GetClassAllExhibitors     getClassAllExhibitors  = new GetClassAllExhibitors();
            List <GetClassExhibitors> getClassListExhibitors = new List <GetClassExhibitors>();
            var allExhibitor = _exhibitorRepository.GetAll(x => x.IsActive == true && x.IsDeleted == false);

            if (allExhibitor.Count != 0)
            {
                for (int i = 0; i < allExhibitor.Count(); i++)
                {
                    GetClassExhibitors getClassExhibitors = new GetClassExhibitors();

                    getClassExhibitors.ExhibitorId = allExhibitor[i].ExhibitorId;
                    getClassExhibitors.Exhibitor   = allExhibitor[i].ExhibitorId + " " + allExhibitor[i].FirstName + " " + allExhibitor[i].LastName;
                    getClassListExhibitors.Add(getClassExhibitors);
                }
                getClassAllExhibitors.getClassExhibitors = getClassListExhibitors;
                _mainResponse.GetClassAllExhibitors      = getClassAllExhibitors;
                _mainResponse.Success = true;
            }
            else
            {
                _mainResponse.Message = Constants.NO_RECORD_FOUND;
                _mainResponse.Success = false;
            }
            return(_mainResponse);
        }
        public MainResponse GetClassExhibitors(int ClassId)
        {
            GetClassAllExhibitors     getClassAllExhibitors  = new GetClassAllExhibitors();
            List <GetClassExhibitors> getClassListExhibitors = new List <GetClassExhibitors>();
            var allExhibitor = _exhibitorRepository.GetAll(x => x.IsActive == true && x.IsDeleted == false);

            if (allExhibitor.Count != 0)
            {
                var exhibitorClasses = _exhibitorClassRepositor.GetAll(x => x.ClassId == ClassId && x.IsActive == true && x.IsDeleted == false);
                var exhibitor        = allExhibitor.Where(x => exhibitorClasses.All(y => y.ExhibitorId != x.ExhibitorId)).OrderBy(z => z.FirstName).ToList();
                if (exhibitor.Count() != 0)
                {
                    for (int i = 0; i < exhibitor.Count(); i++)
                    {
                        GetClassExhibitors getClassExhibitors = new GetClassExhibitors();

                        getClassExhibitors.ExhibitorId = exhibitor[i].ExhibitorId;
                        getClassExhibitors.Exhibitor   = exhibitor[i].ExhibitorId + " " + exhibitor[i].FirstName + " " + exhibitor[i].LastName;
                        getClassListExhibitors.Add(getClassExhibitors);
                    }
                    getClassAllExhibitors.getClassExhibitors = getClassListExhibitors;
                    _mainResponse.GetClassAllExhibitors      = getClassAllExhibitors;
                    _mainResponse.Success = true;
                }
                else
                {
                    _mainResponse.Message = Constants.NO_RECORD_FOUND;
                    _mainResponse.Success = false;
                }
            }
            else
            {
                _mainResponse.Message = Constants.NO_RECORD_FOUND;
                _mainResponse.Success = false;
            }
            return(_mainResponse);
        }