public Task <ISlackResponseMessage> Handle(ListUserKudosQuery request, CancellationToken cancellationToken) { try { KudoSlashCommandValidatorFactory <ListUserKudosQuery> .GetValidator().Validate(request); return(Task.FromResult(kudoService.GetAllUserKudos(request.GetUserId()))); } catch (Exception ex) { throw; } }
public Task <ISlackResponseMessage> Handle(ListTopUsersQuery request, CancellationToken cancellationToken) { try { KudoSlashCommandValidatorFactory <ListTopUsersQuery> .GetValidator().Validate(request); var nUsers = request.Text.Split(' ')[1]; return(Task.FromResult(kudoService.GetTopUsers(nUsers))); } catch (Exception ex) { throw; } }
public Task <ISlackResponseMessage> Handle(DeleteKudoCommand request, CancellationToken cancellationToken) { try { KudoSlashCommandValidatorFactory <DeleteKudoCommand> .GetValidator().Validate(request); var kudoId = int.Parse(request.CommandText.Split(' ')[1]); return(Task.FromResult(kudoService.DeleteKudo(kudoId))); } catch (Exception ex) { throw; } }
public Task <ISlackResponseMessage> Handle(ReplaceKudoCommand request, CancellationToken cancellationToken) { try { KudoSlashCommandValidatorFactory <ReplaceKudoCommand> .GetValidator().Validate(request); var kudo = new Domain.Model.Kudo { Id = int.Parse(request.CommandText.Split(' ')[1]), CommandText = request.CommandText }; return(Task.FromResult(kudoService.ReplaceKudo(kudo))); } catch (Exception ex) { throw; } }
public Task <ISlackResponseMessage> Handle(ListKudosQuery request, CancellationToken cancellationToken) { try { KudoSlashCommandValidatorFactory <ListKudosQuery> .GetValidator().Validate(request); var kudo = new Domain.Model.Kudo { ByUserId = request.UserId, CommandText = request.Text }; return(Task.FromResult(kudoService.GetNKudosByUserId(kudo))); } catch (Exception ex) { throw; } }
public Task <ISlackResponseMessage> Handle(CreateKudoCommand request, CancellationToken cancellationToken) { try { KudoSlashCommandValidatorFactory <CreateKudoCommand> .GetValidator().Validate(request); var kudo = new Domain.Model.Kudo { UserId = request.GetUserId(), Username = request.GetUsername(), ByUserId = request.UserId, ByUsername = request.Username, ChannelId = request.ChannelId, ChannelName = request.ChannelName, CommandText = request.Text }; return(Task.FromResult(kudoService.CreateKudo(kudo))); } catch (Exception ex) { throw; } }