示例#1
0
        public BrokerPolicyTemplate RetrieveBrokerPolicyTemplate(AppUser user)
        {
            BrokerPolicyTemplate template = null;

            if (CheckIsBroker(user) && CheckBrokerHasPolicyTemplate(user))
            {
                template = _dbContext.BrokerPolicyTemplate.FirstOrDefault(t => t.BrokerReferenceId.Equals(Guid.Parse(user.Id)));
            }
            return(template);
        }
示例#2
0
        public bool CreateBrokerPolicyTemplate(AppUser user)
        {
            int result = 0;

            if (CheckIsBroker(user) && !CheckBrokerHasPolicyTemplate(user))
            {
                var brokerTemplate = new BrokerPolicyTemplate()
                {
                    BrokerReferenceId = Guid.Parse(user.Id),
                    CarBrokerRefId    = Guid.Parse(user.Id),
                    CoverBrokerRefId  = Guid.Parse(user.Id),
                    CreationDate      = DateTime.Now,
                    TemplateReady     = false
                };

                _dbContext.BrokerPolicyTemplate.Add(brokerTemplate);
                result = _dbContext.SaveChanges();
            }
            return(result == 1);
        }