public async Task CanUpdateTraineeGroup()
        {
            var authorizedClient = SystemTestExtension.GetTokenAuthorizeHttpClient(_factory);

            var updateTraineeGroupCommand = new UpdateTraineeGroupCommand
            {
                UpdateTraineeGroupCommandModels = new List <UpdateTraineeGroupCommandModel>
                {
                    new UpdateTraineeGroupCommandModel
                    {
                        Name = "traineeGroupSample",
                    }
                }
            };

            var serializedUpdateCommand = JsonConvert.SerializeObject(updateTraineeGroupCommand);

            // The endpoint or route of the controller action.
            var httpResponse = await authorizedClient.PutAsync(requestUri : "/TraineeGroup",
                                                               content : new StringContent(content: serializedUpdateCommand,
                                                                                           encoding: Encoding.UTF8,
                                                                                           mediaType: StringConstants.ApplicationJson));

            //Must be successful
            httpResponse.EnsureSuccessStatusCode();

            Assert.True(httpResponse.IsSuccessStatusCode);
            Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
        }
        public async Task ShouldGetModelForValidInformation()
        {
            var command = new UpdateTraineeGroupCommand
            {
                UpdatedBy = _adminUserId,
                TenantId  = _tenantId,
                UpdateTraineeGroupCommandModels = new List <UpdateTraineeGroupCommandModel>
                {
                    new UpdateTraineeGroupCommandModel
                    {
                        Name = "Updated"
                    }
                }
            };

            var traineeGroupModel = await _commandHandler.Handle(command, CancellationToken.None);

            Assert.Null(traineeGroupModel.Errors);

            Assert.True(traineeGroupModel.Items.Single().Count > 0);
        }
        public async Task <ActionResult <ResponseModel <UpdateTraineeGroupModel> > > Put([FromBody] UpdateTraineeGroupCommand command)
        {
            try
            {
                command.UpdatedBy = Claims[ClaimTypes.Sid].ToInt();
                command.TenantId  = Guid.Parse(Claims[ClaimTypes.UserData]);

                var updateTraineeGroupModel = await Mediator.Send(command);

                return(Ok(updateTraineeGroupModel));
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
            catch (ObjectAlreadyExistsException ex)
            {
                return(Conflict(new ResponseModel <UpdateTraineeGroupModel>(new Error(HttpStatusCode.Conflict, ex))));
            }
            catch
            {
                return(StatusCode(HttpStatusCode.InternalServerError.ToInt()));
            }
        }