public IActionResult CreateDiscipline(DisciplineToCreate disciplineToCreate)
        {
            if (disciplineToCreate == null)
            {
                _logger.LogError($"{nameof(DisciplineToCreate)} object sent from client is null.");
                return(BadRequest());                // View ?
            }

            var discipline = _mapper.Map <Discipline>(disciplineToCreate);

            _repository.Discipline.CreateDiscipline(discipline);
            _repository.Save();

            return(StatusCode(201));            // View
        }
        public void CreateDiscipline_ShouldWorks()
        {
            var disciplineDto = new DisciplineToCreate
            {
                Title                   = "New discipline",
                IsOpenToRegistry        = true,
                MaxAmountOfStudents     = 10,
                CurrentAmountOfStudents = 2
            };

            var discipline = _mapper.Map <Discipline>(disciplineDto);

            _repositoryManager.Discipline.CreateDiscipline(discipline);
            _repositoryManager.Save();

            var disciplineToCheck = this._repositoryManager.Discipline.FindDisciplineByTitle(disciplineDto.Title, trackChanges: false);

            Assert.True(discipline.Equals(disciplineToCheck));
        }