public CatalogInfoViewModel getCatalogInfoValues(int custAutoID)
        {
            CatalogInfoViewModel catalogInfoVM = new CatalogInfoViewModel();
            QuoteViewService     quoteService  = new QuoteViewService();

            catalogInfoVM.ThisUserID     = custAutoID;
            catalogInfoVM.CatalogOptions = FillCatalogOptionsInfo(catalogInfoVM.ThisUserID);
            catalogInfoVM.ValidationCatalogBasicProfileModel = FillValidationsInfo();
            CustomerCatalogInformation ccInfo = _Context.CustomerCatalogInformation.GetAll(e => e.CustAutoID == custAutoID).OrderByDescending(e => e.UpdatedDate).FirstOrDefault();

            catalogInfoVM.UpdatedDate     = ccInfo != null ? ccInfo.UpdatedDate : (DateTime?)null;
            catalogInfoVM.UpdatedUserName = ccInfo != null ? ccInfo.User != null?ccInfo.User.UserName.ToString() : string.Empty : string.Empty;

            quoteService.UserVM   = UserVM;
            UserVM.CurrentQuoteID = quoteService.getCustomerSCQuoteID();
            catalogInfoVM.UserVM  = UserVM;
            return(catalogInfoVM);
        }
        public void UpdateStatusandInsertforCustomerCatalogInformation(List <CustomerCatalogInformation> lstCustomerCatalogInfo, List <CreateCatalogInfoModel> lstcreatecatInfoModel, int custAutoID)
        {
            CustomerCatalogInformation createCustomerCatalogInfo = null;
            List <int> lstCSOVIDs = lstcreatecatInfoModel.Select(e => e.CatalogSubjectOptionValueID).ToList();

            //updating the status to Inactive for already existing record if it is not existing- in Customer Catalog Information
            if (lstCustomerCatalogInfo != null && lstCustomerCatalogInfo.Count() > 0)
            {
                List <CustomerCatalogInformation> lstNotMatchedCustomerCatInfo = lstCustomerCatalogInfo.Where(e => !lstCSOVIDs.Contains((int)e.CatalogSubjectOptionValueID)).Select(e => e).ToList();
                foreach (CustomerCatalogInformation CCInfo in lstNotMatchedCustomerCatInfo)
                {
                    CCInfo.Status = false;
                    _Context.CustomerCatalogInformation.SaveChanges();
                }
            }
            //Insertion
            foreach (CreateCatalogInfoModel ccInfoModel in lstcreatecatInfoModel)
            {
                if (lstCustomerCatalogInfo.Where(e => e.CatalogSubjectOptionValueID == ccInfoModel.CatalogSubjectOptionValueID).FirstOrDefault() == null)
                {
                    createCustomerCatalogInfo = new CustomerCatalogInformation();
                    createCustomerCatalogInfo.CatalogSubjectOptionValueID = ccInfoModel.CatalogSubjectOptionValueID;
                    createCustomerCatalogInfo.CustAutoID     = custAutoID;
                    createCustomerCatalogInfo.Comments       = ccInfoModel.Comments;
                    createCustomerCatalogInfo.CreatedDate    = DateTime.UtcNow;
                    createCustomerCatalogInfo.UpdatedDate    = DateTime.UtcNow;
                    createCustomerCatalogInfo.Status         = true;
                    createCustomerCatalogInfo.LoggedInUserID = UserVM.CRMModelProperties.LoggedINUserID;
                    _Context.CustomerCatalogInformation.Add(createCustomerCatalogInfo);
                }
                else
                {
                    CustomerCatalogInformation updateCustomerCatalogInfo = lstCustomerCatalogInfo.Where(e => e.CatalogSubjectOptionValueID == ccInfoModel.CatalogSubjectOptionValueID).FirstOrDefault();
                    updateCustomerCatalogInfo.CustomerCatID  = updateCustomerCatalogInfo.CustomerCatID;
                    updateCustomerCatalogInfo.Comments       = ccInfoModel.Comments;
                    updateCustomerCatalogInfo.Status         = true;
                    updateCustomerCatalogInfo.UpdatedDate    = DateTime.UtcNow;
                    updateCustomerCatalogInfo.LoggedInUserID = UserVM.CRMModelProperties.LoggedINUserID;
                }
            }
            _Context.CustomerCatalogInformation.SaveChanges();
        }