public override async Task <ScenarioResult> OnMessage(MessageEventArgs args) { var dbFeedback = new DBFeedback(args.Message.Text); await Repository.AddFeedback(args.Message.ForwardFrom, dbFeedback); await PrintMenu("Ваше сообщение отправлено разработчикам, можете написать ещё что-нибудь:"); return(ScenarioResult.ContinueCurrent); }
public async Task <DBFeedback> AddFeedback(User user, DBFeedback feedback) { using var connection = await CreateAndOpenConnection(); var userID = await AddOrUpdateUserCore(connection, user); feedback.User = userID; return(await AddFeedbackCore(connection, feedback)); }
async Task <DBFeedback> AddFeedbackCore(NpgsqlConnection conection, DBFeedback feedback) => await conection.QuerySingleAsync <DBFeedback>( @"insert into reviews(user, feedback) values (@User, @Feedback) returning id as ID, create_time as CreateTime, user as User, feedback as Feedback", feedback);
public async Task <DBFeedback> AddFeedback(DBFeedback feedback) { using var connection = await CreateAndOpenConnection(); return(await AddFeedbackCore(connection, feedback)); }