public async Task <ActionResult> SendMessage(SendMessageForm form)
        {
            try
            {
                await _service.SendMessage(form.Id, form.Token, form.IdDial, form.Data);

                return(Ok());
            }
            catch (Exception e)
            {
                return(StatusCode(215, e.Message));
            }
        }
Ejemplo n.º 2
0
        public async Task <ServiceResult <object> > SendMessage(SendMessageForm sendMessageForm)
        {
            var user = await AccountService.UserFromId(sendMessageForm.UserId);

            if (user.State != ServiceResultEnum.Exist)
            {
                return(Result(user.State, user.Detail));
            }
            var group = await GroupService.GroupFromId(sendMessageForm.ChatGroupId);

            if (group.State != ServiceResultEnum.Exist)
            {
                return(Result(group.State, group.Detail));
            }
            return(await GroupService.SendMessage(user.ExtraData, group.ExtraData, sendMessageForm.MessageType, sendMessageForm.MessageContent));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> SendMessage([FromBody] SendMessageForm form)
        {
            var postedMessage = PostedMessage.New(form.Message);

            await _context.PostedMessages.AddAsync(postedMessage);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception exception)
            {
                var details = exception.ToString();
                Console.WriteLine(details);
            }

            await _bus.Send(new ProcessMessageCommand(postedMessage.Id));

            return(Ok());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> SendMessage([FromBody] SendMessageForm form)
        {
            await _bus.Send(new SendMessageCommand(form.Message));

            return(Ok());
        }
        private void OnShowSendMessageForm(object sender, EventArgs e)
        {
            var sendMessageForm = new SendMessageForm();

            sendMessageForm.Show();
        }