예제 #1
0
        public IActionResult Send(
            [FromQuery(Name = "api_id")] Guid apiId,
            [FromQuery] String from,
            [FromQuery] Int32 json,
            [FromQuery(Name = "msg")] String encodedMsg,
            [FromQuery] String to
            )
        {
            var msg   = Uri.UnescapeDataString(encodedMsg);
            var phone = new Phone(to);

            this._logger.LogInformation($"Received message to {phone}");
            var account = this.Find(from);
            var cascade = new Cascade(
                this.CreateValidators(
                    account,
                    phone
                    )
                );

            this.TryToSaveMessage(new Sms {
                Message = msg, To = phone.ToString()
            }, cascade.Answer());
            return(new OkObjectResult(
                       new OkFromSmsRu(
                           phone,
                           cascade.Answer(),
                           account
                           )
                       ));
        }