Exemplo n.º 1
0
 private async Task HandleAsync(EnableOnlineAccessEvent @event)
 {
     try
     {
         //await _emailSender.SendEmailAsync(@event.Email, @event.Subject, @event.Body);
     }
     catch (Exception ex)
     {
         //throw ex;
         Log.Error(ex, "Error while sending notification message {user}.", @event.Email);
     }
     //throw new NotImplementedException();
 }
Exemplo n.º 2
0
        private async Task <bool> HandleAsync(EnableOnlineAccessEvent onlineAccessEnabledEvent)//, [FromServices]UserManager<ApplicationUser> _userManager)
        {
            //var user = new ApplicationUser
            //{
            //    UserName = onlineAccessEnabledEvent.UserName,
            //    Email = onlineAccessEnabledEvent.Email,
            //    AvatarImgUrl = "Images/Avatars/default.png",
            //    FirstName = onlineAccessEnabledEvent.FirstName,
            //    LastName = onlineAccessEnabledEvent.LastName,
            //    JoinDate = DateTime.Now,
            //    EmailConfirmed = true,
            //    UserRole = onlineAccessEnabledEvent.UserRole
            //};

            //try
            //{
            //    var result = await _userManager.CreateAsync(user, onlineAccessEnabledEvent.Password);

            //    var role_resuls = await _userManager.AddToRoleAsync(user, onlineAccessEnabledEvent.UserRole);

            //    if (!result.Succeeded /*&& !role_resuls.Succeeded*/) return false; // BadRequestObjectResult(Errors.AddErrorsToModelState(result, ModelState));

            //    //await _appDbContext.Customers.AddAsync(new Customer { IdentityId = userIdentity.Id, Location = model.Location });
            //    await _appDbContext.SaveChangesAsync();

            //}
            //catch (Exception ex)
            //{
            //    throw ex;

            //}

            return(true);

            //throw new NotImplementedException();
        }