public ActionResult Brokerage(int CustomerId)
        {
            BrokeragerModel BrokeragerModel = new Web.Models.BrokeragerModel();
            List <BrokeragerDetailModel> BrokeragerDetailModelList = new List <BrokeragerDetailModel>();
            var BrokerageServices = _BrokerageServiceServices.BrokerageSevicess();

            Mapper.CreateMap <CommunicationApp.Entity.Brokerage, CommunicationApp.Web.Models.BrokeragerModel>();
            foreach (var BrokerageService in BrokerageServices)
            {
                if (BrokerageService.ParentId == null)
                {
                    BrokeragerDetailModelList.Add(ServiceModel(BrokerageService));

                    //filtter record according to parent
                    Mapper.CreateMap <CommunicationApp.Entity.Property, CommunicationApp.Web.Models.PropertyModel>();
                    var FiltterBrokerages = BrokerageServices.Where(c => c.ParentId == ServiceModel(BrokerageService).BrokerageServicesId);
                    foreach (var FiltterBrokerage in FiltterBrokerages)
                    {
                        BrokeragerDetailModelList.Add(ServiceModel(FiltterBrokerage));
                    }
                }
            }
            BrokeragerModel.BrokeragerDetailModelList = BrokeragerDetailModelList;
            BrokeragerModel.CustomerId = CustomerId;
            return(View(BrokeragerModel));
        }
        public ActionResult GetBrokerage(int BrokerageId)
        {
            BrokeragerModel       BrokeragerModel    = new Web.Models.BrokeragerModel();
            List <PDFDetailModel> PDFDetailModelList = new List <PDFDetailModel>();
            //get data from brokerage table
            var BrokerageDetail = _BrokerageService.GetBrokerage(BrokerageId);

            if (BrokerageDetail != null)
            {
                Mapper.CreateMap <CommunicationApp.Entity.Brokerage, CommunicationApp.Web.Models.BrokeragerModel>();
                BrokeragerModel = Mapper.Map <CommunicationApp.Entity.Brokerage, CommunicationApp.Web.Models.BrokeragerModel>(BrokerageDetail);
                var cust = _CustomerService.GetCustomer(Convert.ToInt32(BrokerageDetail.CustomerId));
                BrokeragerModel.EmailId  = cust.EmailId;
                BrokeragerModel.TrebId   = cust.TrebId;
                BrokeragerModel.MobileNo = cust.MobileNo;
                //Get brokerage detail table
                var BrokerageDetailObj = _BrokerageDetailServices.BrokerageDetail().Where(c => c.BrokerageId == BrokeragerModel.BrokerageId).ToList();
                Mapper.CreateMap <CommunicationApp.Entity.BrokerageDetail, CommunicationApp.Web.Models.PDFDetailModel>();
                foreach (var Brokeragedtail in BrokerageDetailObj)
                {
                    var _model           = Mapper.Map <CommunicationApp.Entity.BrokerageDetail, CommunicationApp.Web.Models.PDFDetailModel>(Brokeragedtail);
                    var Brokerageservice = _BrokerageServiceServices.GetBrokerageService(Convert.ToInt32(_model.BrokerageServicesId));
                    if (Brokerageservice != null)
                    {
                        _model.ParentId       = Brokerageservice.ParentId;
                        _model.BrokerageValue = _model.BrokerageServicesValue.ToString();
                    }
                    PDFDetailModelList.Add(BrokerDetailFunction(_model));

                    ////filtter record according to parent
                    //var FiltterBrokerages = BrokerageDetailObj.Where(c => c.ParentId == ServiceModel(BrokerageService).BrokerageServicesId);
                    //foreach (var FiltterBrokerage in FiltterBrokerages)
                    //{
                    //    PDFDetailModelList.Add(ServiceModel(FiltterBrokerage));
                    //}
                }
            }

            BrokeragerModel.PDFDetailModelModelList = PDFDetailModelList;

            return(View("~/Views/Brokerage/PDF.cshtml", BrokeragerModel));
        }