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); }
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); }