public Message Create([FromBody] MessageOnCreate msg) { Log.Debug("Создание сообщения."); var result = _messagesRepository.Send(msg.Text, msg.UserId, msg.ChatId, msg.Files.Select(f => f.FileName), msg.Files.Select(f => f.FileData), msg.SelfDestruction, msg.DestructionTime); Log.Debug($"Создание сообщения завершено, Id = {result.Id}."); return(result); }
public static Model.Message SendMessage(MessageOnCreate message) { if (!isInitialized) { Initialize(); } HttpResponseMessage response = client.PostAsJsonAsync(prefix + "messages", message).Result; if (response.IsSuccessStatusCode) { return(response.Content.ReadAsAsync <Model.Message>().Result); } else { throw new Exception(response.Content.ReadAsStringAsync().Result); } }