public async Task <IActionResult> Login([FromBody] LoginViewModel creds) { seedHelper.EnsurePopulated(context); //IdentitySeedData.EnsurePopulated(userManager, roleManager); var result = await signInManager.PasswordSignInAsync(creds.Name, creds.Password, false, false); if (result.Succeeded) { var appUser = await userManager.FindByNameAsync(creds.Name); var token = await GenerateJwtToken(/*creds.Name,*/ appUser); return(Ok(new { token, appUser.Id })); } return(BadRequest("Invalid login attempt")); }
public Repository(DataContext ctx, ISeedHelper seedHelper, ICommentHelper <T> commentHelper) { context = ctx; this.commentHelper = commentHelper; seedHelper.EnsurePopulated(ctx); }
/// <summary> /// Initializes a new instance of the <see cref="EFOrderRepository"/> class. /// </summary> public EFOrderRepository(DataContext ctx, UserManager <User> userManager, ISeedHelper seedHelper) { context = ctx; seedHelper.EnsurePopulated(ctx); }
/// <summary> /// Initializes a new instance of the <see cref="ImageRepository"/> class. /// </summary> /// <param name="ctx">The CTX.</param> public ImageRepository(DataContext ctx, ISeedHelper seedHelper) { context = ctx; seedHelper.EnsurePopulated(ctx); }