public IActionResult Put(int id, [FromBody] ProgramTypeDto dto)
        {
            var programType = _programTypeService.UpdateProgramType(id, dto);

            if (programType == null)
            {
                return(BadRequest("Another programType with such FitnessProgramName already exists"));
            }

            return(NoContent());
        }
Пример #2
0
        public ProgramType UpdateProgramType(int id, ProgramTypeDto dto)
        {
            var type = _typeRepository.Find(id);

            if (type == null)
            {
                throw new Exception("Type not found");
            }
            type.Name = dto.Name;
            _typeRepository.Save();
            return(type);
        }