Пример #1
0
        public ClassConcentrationGetDto CreateClassConcentration(ClassConcentrationCreateDto classConcentrationCreateDto)
        {
            var classConcentration = new ClassConcentration
            {
                ClassId         = classConcentrationCreateDto.ClassId,
                ConcentrationId = classConcentrationCreateDto.ConcentrationId
            };

            _context.Set <ClassConcentration>().Add(classConcentration);
            _context.SaveChanges();

            var classConcentrationGetDto = new ClassConcentrationGetDto
            {
                Id              = classConcentration.Id,
                ClassId         = classConcentration.ClassId,
                ConcentrationId = classConcentration.ConcentrationId
            };

            return(classConcentrationGetDto);
        }
        public IActionResult Post([FromBody] ClassConcentrationCreateDto classConcentrationCreateDto)
        {
            var classConcentration = _classConcentrationRepository.CreateClassConcentration(classConcentrationCreateDto);

            return(Created("[controller]", classConcentration));
        }