Esempio n. 1
0
        public Session Add(DTO.Session session)
        {
            Player domainPlayer = RepositoryProxy.Instance.PlayerRepository.Get(session.Characters.First().Player);

            Session domainSession = new Session()
            {
                Name = session.Name,
            };

            _db.Set <Session>().Add(domainSession);
            _db.SaveChanges();

            Character domainCharacter = new Character()
            {
                Name    = session.Characters.First().Name,
                Health  = 20,
                Player  = domainPlayer,
                Session = domainSession
            };

            _db.Set <Character>().Add(domainCharacter);
            _db.SaveChanges();

            return(Get(domainSession.SessionID));
        }
Esempio n. 2
0
        public Character Add(DTO.Character character)
        {
            Character domainCharacter = CharacterConverter.DTOToDomain(character);

            _db.Characters.Add(domainCharacter);
            _db.SaveChanges();
            return(domainCharacter);
        }
Esempio n. 3
0
        public Log Add(DTO.Log log)
        {
            Log domainLog = LogConverter.DTOToDomain(log);

            _db.Logs.Add(domainLog);
            _db.SaveChanges();
            return(Get(domainLog.LogID));
        }
Esempio n. 4
0
        public Player Add(DTO.Player player)
        {
            Player domainPlayer = new Player()
            {
                Name = player.Name
            };

            _db.Players.Add(domainPlayer);
            _db.SaveChanges();
            return(domainPlayer);
        }