示例#1
0
        public async Task <IActionResult> Create(CreateChatViewModel model)
        {
            var result = await chatService.Create(mapper.Map <Chat>(model));

            if (result.IsSuccessed)
            {
                return(Ok(result.Result));
            }

            return(BadRequest(result.ErrorMessage));
        }
        private CreateChatViewModel CreateChatCreationViewModel(Window dialogWindow)
        {
            var cancelChatCreationCommand = commandFactoryService.CreateCommand(CommandTypes.CloseWindowCommand);

            ((CloseWindowCommand)cancelChatCreationCommand).Window = dialogWindow;

            var createChatCommand = commandFactoryService.CreateCommand(CommandTypes.CreateChatCommand);

            ((CreateChatCommand)createChatCommand).Window = (ChatSettingsDialogWindow)dialogWindow;

            var addChatMemberToGroupListCommand = commandFactoryService.CreateCommand(CommandTypes.AddChatMemberToGroupListCommand);

            var removeChatMemberFromGroupListCommand = commandFactoryService.CreateCommand(CommandTypes.RemoveChatMemberFromGroupListCommand);

            var viewModel = new CreateChatViewModel(
                cancelChatCreationCommand,
                addChatMemberToGroupListCommand,
                createChatCommand,
                removeChatMemberFromGroupListCommand);

            return(viewModel);
        }
 public CreateChat()
 {
     InitializeComponent();
     BindingContext = new CreateChatViewModel();
 }