public ActionResult Index(MessageModel model) { var roomService = new RoomService(model.ApiKey); var roomId = model.Rooms.Where(a => a.IsSelected).Select(a => (int?)a.Id).FirstOrDefault(); if (roomId == null) { return new EmptyResult(); } var message = new Message { Color = model.Color, MessageFormat = model.IsHtml ? MessageFormatEnum.Html : MessageFormatEnum.Text, Notify = model.SuchAnnoy, Text = model.Message }; roomService.SendMessage(roomId.Value, message); return new EmptyResult(); }
public void SendMessage(int roomId, Message message) { var response = HttpHelpers.PostObject("https://api.hipchat.com/v2/room/" + roomId + "/notification?auth_token=" + _apiKey, message); }