Пример #1
0
        public async Task <IActionResult> CreateCharacter(CharacterForCreateDto characterForCreateDto)
        {
            if (await _repository.CharacterExist(characterForCreateDto.Nickname))
            {
                return(BadRequest("Character with that nickname exist!"));
            }

            var characterToCreate = new Character
            {
                Nickname   = characterForCreateDto.Nickname,
                UserId     = Convert.ToInt32(characterForCreateDto.UserId),
                Level      = 1,
                Experience = 1,
                FullHealth = 100,
                FullMana   = 100,
                Cp         = 1
            };

            await _repository.CreateCharacter(characterToCreate);

            return(StatusCode(201));
        }