public ActionResult <IEnumerable <object> > GetNames(SingleString name) { var users = _userService.SearchByName(name.String); var projection = users.Select(u => new { u.UserID, u.Name }).ToArray(); return(projection); }
/// <summary> /// Parse the entry. /// </summary> /// <param name="byteData">The MPEG2 section containing the transport stream.</param> /// <param name="index">Index of the first byte of the transport stream in the MPEG2 section.</param> internal void Process(byte[] byteData, int index) { lastIndex = index; try { int numberOfStrings = (int)byteData[lastIndex]; lastIndex++; if (numberOfStrings != 0) { strings = new Collection <SingleString>(); while (numberOfStrings != 0) { SingleString singleString = new SingleString(); singleString.Process(byteData, lastIndex); strings.Add(singleString); lastIndex = singleString.Index; numberOfStrings--; } } Validate(); } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The Multiple String message is short")); } }
/// <inheritdoc /> public override async Task <BooleanReply> RequestPasswordReset(SingleString request, ServerCallContext context) { m_logger.LogDebug("Received password reset request for {0}", request.Content); var user = await m_userManager.FindByNameAsync(request.Content).ConfigureAwait(false); if (user is null) { // The client shouldn't know if the email is registered return new BooleanReply { Error = 0, Reply = true } } ; var token = await m_userManager.GeneratePasswordResetTokenAsync(user).ConfigureAwait(false); await m_emailService.SendRecoveryCodeAsync(request.Content, user.Id, token, context.CancellationToken).ConfigureAwait(false); return(new BooleanReply { Error = 0, Reply = true }); }
public static void Main() { // tests for digits with spaces string digitsSeparatedTrue = "1 4 2 1 6"; string digitsSeparatedFalse = "1 22 "; Lexer digitsTrue = new DigitsWithSpaces(digitsSeparatedTrue); Lexer digitsFalse = new DigitsWithSpaces(digitsSeparatedFalse); // tests for alternate groups string alternateTrue = "aa42aa5bb1"; string alternateFalse = "b22aaa"; string alternateFalse2 = "4ds2212d4"; Lexer altTrue = new AlternateGroups(alternateTrue); Lexer altFalse = new AlternateGroups(alternateFalse); Lexer altFalse2 = new AlternateGroups(alternateFalse2); // tests for floating points string floatingTrue = "321321.3123123"; string floatingFalse = ".412"; Lexer floatTrue = new FloatingPoint(floatingTrue); Lexer FloatFalse = new FloatingPoint(floatingFalse); // tests for single string; string stringTrue = "'dasdasd'"; string stringFalse = "'dasda'dasd'"; Lexer strTrue = new SingleString(stringTrue); Lexer strFalse = new SingleString(stringFalse); // tests for multiline comment string commentTrue = "/* sadsadsa */"; string commentFalse = "/*gfdgf*/agfdgdfgs*/"; string commentFalse2 = "/*dsadas"; Lexer commTrue = new MultilineComment(commentTrue); Lexer commFalse = new MultilineComment(commentFalse); Lexer commFalse2 = new MultilineComment(commentFalse2); try { // расскоментировать строчку для проверки // то, что помечено True - должно работать // то, что помечено False - должно выдавать ошибку //digitsTrue.Parse(); //digitsFalse.Parse(); //altTrue.Parse(); //altFalse.Parse(); //altFalse2.Parse(); //floatTrue.Parse(); //FloatFalse.Parse(); //strTrue.Parse(); //strFalse.Parse(); //commTrue.Parse(); commFalse.Parse(); //commFalse2.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } }
/// <inheritdoc /> public override async Task <BooleanReply> UserExists(SingleString request, ServerCallContext context) { var user = await m_userManager.FindByNameAsync(request.Content).ConfigureAwait(false); return(new BooleanReply { Reply = user is not null });
/// <inheritdoc /> public override async Task <BooleanReply> UserExists(SingleString request, ServerCallContext context) { m_logger.LogDebug("Received user exists request for {0}", request.Content); var user = await m_userManager.FindByNameAsync(request.Content).ConfigureAwait(false); return(new BooleanReply { Reply = user is not null });
public async Task <ActionResult> RemoveIP([FromBody] SingleString val) { await _banService.RemoveIPBan(val.String); return(NoContent()); }
public async Task <ActionResult> BanEmail([FromBody] SingleString val) { await _banService.BanEmail(val.String); return(NoContent()); }
public ActionResult RemoveIP([FromBody] SingleString val) { _banService.RemoveIPBan(val.String); return(NoContent()); }
public ActionResult BanIP([FromBody] SingleString val) { _banService.BanIP(val.String); return(NoContent()); }
/// <summary> /// Parse the entry. /// </summary> /// <param name="byteData">The MPEG2 section containing the transport stream.</param> /// <param name="index">Index of the first byte of the transport stream in the MPEG2 section.</param> internal void Process(byte[] byteData, int index) { lastIndex = index; try { int numberOfStrings = (int)byteData[lastIndex]; lastIndex++; if (numberOfStrings != 0) { strings = new Collection<SingleString>(); while (numberOfStrings != 0) { SingleString singleString = new SingleString(); singleString.Process(byteData, lastIndex); strings.Add(singleString); lastIndex = singleString.Index; numberOfStrings--; } } Validate(); } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The Multiple String message is short")); } }
internal Method GetMethod(SingleString str) { return(x => FObject.NewString(str.Invoke(x[0].IsString()))); }