コード例 #1
0
        public void Create(DalUser entity)
        {
            User user = new User()
            {
                Email = entity.Email,
                PasswordHash = entity.PasswordHash,
                CreationDate = entity.CreationDate,
                Roles = GetRoles(entity.Roles.Select(r => r.Name)).ToList()
            };

            context.Set<User>().Add(user);
        }
コード例 #2
0
        public void Update(DalUser entity)
        {
            User user = context.Set<User>().FirstOrDefault(u => u.Id == entity.Id);

            if (user != null)
            {
                user.PasswordHash = entity.PasswordHash;
                user.Roles = GetRoles(entity.Roles.Select(r => r.Name)).ToList();
            }
        }