Beispiel #1
0
        public async Task <DbExecutionStatus> Add(int trainingCreatorId, Training training)
        {
            try
            {
                var result = await Add(training);

                if (result == DbExecutionStatus.Failed)
                {
                    return(result);
                }

                // Now create session for this training
                var newSession = new ChatSession()
                {
                    Type       = ChannelType.Private,
                    TrainingId = training.Id,
                    Name       = training.Name + new Random().Next()
                };

                // Create training goals for this training
                await _goalsService.CreateTrainingGoals(training.Id, training.Scenario.Id);


                return(await _sessionsService.Add(newSession));
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Failed Saving the training {ex}");
                return(DbExecutionStatus.Failed);
            }
        }
Beispiel #2
0
        public async Task <ActionResult <ChatSession> > PostChatSession(ChatSession chatSession)
        {
            var result = await _sessionsService.Add(chatSession);

            return(result.ConvertToWebAPI <ChatSession>(CreatedAtAction("GetChatSession", new { id = chatSession.Id }, chatSession)));
        }