コード例 #1
0
        public IEnumerable <object> GetAllLawFirm(bool order)
        {
            var modes = _repository.Get()
                        .OrderBy(d => d.areaOfPreference)
                        .ToList();

            List <object> retList        = new List <object>();
            var           firmCategories = _firmRepository.Get();

            try
            {
                foreach (var firmCategory in firmCategories)
                {
                    var lawCategoryId = firmCategory.lawCategoryId;
                    var firmId        = firmCategory.RipOffFirmId;
                    var ripfirms      = _ripRepository.Get().Where(d => d.Id == firmId);

                    retList.Add(new { RipOffFirm = firmCategory, ripFirm = ripfirms });
                }
            }
            catch (Exception ex)
            {
                var result = new { Message = ex.Message, InnerException = ex.InnerException.ToString() };
            }

            return(retList.AsEnumerable().ToList());
        }
コード例 #2
0
        public IEnumerable <object> Get(int id)
        {
            var modes = firmRepository.Get()
                        .Where(d => d.Id == id)
                        .ToList();

            List <object> retList = new List <object>();

            foreach (var ripOff in modes)
            {
                var firmId         = ripOff.Id;
                var firmCategories = ripOff.FirmCategories;
                try
                {
                    foreach (var firmCategory in firmCategories)
                    {
                        var lawCategoryId = firmCategory.lawCategoryId;
                        var lawCategories = lawyerRepository.Get().Where(d => d.Id == lawCategoryId).ToList();
                        var riplawyers    = _riplawyer.Get().Where(d => d.RipOffFirmId == firmId);

                        retList.Add(new { RipOffFirm = ripOff, lawCategories = lawCategories, lawyers = riplawyers });
                    }
                }
                catch (Exception ex)
                {
                    var result = new { Message = ex.Message, InnerException = ex.InnerException.ToString() };
                }
            }
            return(retList.AsEnumerable().ToList());
        }