예제 #1
0
        public LodestoneCharacterModel VerifyLodestone(string userId, string characterId, string code)
        {
            var parser = new LodestoneParser.LodestoneParser();

            parser.LoadCharacter(int.Parse(characterId));
            var contains = parser.CheckProfileContains(code);

            if (contains)
            {
                var name   = parser.GetName();
                var server = parser.GetServer();
                var icon   = parser.GetIconUrl();

                var model = new LodestoneCharacterModel
                {
                    Id          = 0,
                    UserId      = userId,
                    CharacterId = characterId,
                    Icon        = icon,
                    Server      = server,
                    Name        = name
                };

                return(_repo.AddLodestoneCharacter(model));
            }

            return(null);
        }
예제 #2
0
        public LodestoneCharacterModel AddLodestoneCharacter(LodestoneCharacterModel model)
        {
            var entity = _mapper.Map <LodestoneCharacter>(model);

            _context.LodestoneCharacters.Add(entity);
            _context.SaveChanges();

            return(_mapper.Map <LodestoneCharacterModel>(entity));
        }