示例#1
0
        public async Task <Result <Exception, Company> > CreateAsync(Company company)
        {
            EntityEntry <Company> newCompany = _context.Companies.Add(company);

            await _context.SaveChangesAsync();

            return(newCompany.Entity);
        }
示例#2
0
        public async Task <Result <Exception, Profile> > CreateAsync(Profile entity)
        {
            EntityEntry <Profile> newEntity = _context.AgentProfiles.Add(entity);

            await _context.SaveChangesAsync();

            return(newEntity.Entity);
        }
示例#3
0
        public async Task <Result <Exception, Agent> > CreateAsync(Agent agent)
        {
            agent.Password = agent.Password.GenerateHash();
            EntityEntry <Agent> newAgent = _context.Agents.Add(agent);

            await _context.SaveChangesAsync();

            return(newAgent.Entity);
        }