public async Task <IActionResult> Confirm(ConfirmationTokenType type, Guid value) { var query = from ct in db.ConfirmationTokens join u in db.Users on ct.UserId equals u.UserId where ct.Type == type && ct.Value == value select new { ConfirmationToken = ct, User = new User { UserId = u.UserId, Status = u.Status } }; var result = await query.SingleOrDefaultAsync(); if (result == null) { return(NotFound(TokenNotFound)); } db.Attach(result.ConfirmationToken); db.Attach(result.User); result.User.Status = UserStatus.Active; db.ConfirmationTokens.Remove(result.ConfirmationToken); await db.SaveChangesAsync(); return(NoContent()); }
public async Task ConfirmAsync(ConfirmationTokenType type, Guid value) { await http.PutAsync($"/confirm/{type}/{value}"); }