public IActionResult GetMessage([FromRoute] int groupId, [FromRoute] int messageId) { var userId = Request.GetUserId(); var message = _chatFacade.GetMessage(messageId, groupId, userId); var response = new UserMessageResponse(message.Id, message.SentOn, message.MessageType, message.SenderId, message.SenderName, message.Text); return(Ok(response)); }
public bool CanClose() { var token = new CloseToken(); UserMessageResponse userResponse = UserMessageResponse.Yes; _events.SendMessage <ICloseable>(x => x.AddCanCloseMessages(token)); if (token.Messages.Length > 0) { string userMessage = string.Join("\n", token.Messages); userResponse = _messageBox.AskUser(CAN_CLOSE_TITLE, userMessage); } if (userResponse == UserMessageResponse.Yes) { _events.SendMessage <ICloseable>(x => x.PerformShutdown()); } return(userResponse == UserMessageResponse.Yes); }
public bool CanClose() { if (!_stateManager.IsDirty()) { return(true); } string message = "Select OK to save changes to {0}, No to discard changes or cancel to continue editing".ToFormat( _test.Name); UserMessageResponse dialogResult = _messageBox.AskUserCanCancel("Unsaved Changes", message); bool result = false; //Something better to do here than a switch statement I'm sure. switch (dialogResult) { //User says to save changes (OK) case UserMessageResponse.Yes: var applied = _controller.SaveChanges(); if (!applied) { throw new NotImplementedException(); } result = true; break; //User says cancel close changes (No) case UserMessageResponse.Cancel: break; //User says discard changes (cancel) default: result = true; break; } return(result); }
public AllPossibleMessages(UserMessageResponse userMessage, GroupMessageResponse groupMessage) { UserMessage = userMessage; GroupMessage = groupMessage; }