Ejemplo n.º 1
0
        public async Task <Monster> Create(Monster monster)
        {
            var result = await Task.FromResult(_dapper.Insert <Monster>("insert into Monster(MonsterName, Level, Health, MaxHealth, ZoneId)" +
                                                                        $" values('{monster.MonsterName}', {monster.Level}, {monster.Health}, {monster.MaxHealth}, {monster.Zone.ZoneId})", null, commandType: CommandType.Text));

            return(result);
        }
Ejemplo n.º 2
0
        public void Insert(NotesModel notes)
        {
            var sql        = "INSERT INTO public.notes (notes, favorited_id, user_id) VALUES (@notes, @favorited_id, @user_id)";
            var parameters = notes;

            _postgreSQL.Insert(sql, parameters);
        }
Ejemplo n.º 3
0
        public async Task <Quest> Create(Quest Quest)
        {
            var result = await Task.FromResult(_dapper.Insert <Quest>("insert into Quest(XpReward, GoldReward, IsComplete, NpcId)" +
                                                                      $" values({Quest.XpReward}, {Quest.GoldReward}, {(Quest.IsComplete ? 1 : 0)}, {Quest.Npc.NpcId})", null, commandType: CommandType.Text));

            return(result);
        }
        public async Task <Item> Create(Item item)
        {
            var result = await Task.FromResult(_dapper.Insert <Item>("insert into Item (ItemName, LevelRequirement, ItemType, Equipped, StrengthBonus, DefenseBonus, HealthBonus, BuyPrice, PlayerId)" +
                                                                     $" values('{item.ItemName}', {item.LevelRequirement}, '{item.ItemType}', {(item.Equipped ? 1 : 0)}, {item.StrengthBonus}, {item.DefenseBonus}, {item.HealthBonus}, " +
                                                                     $"{item.BuyPrice}, {item.Player.PlayerId})", null, commandType: CommandType.Text));

            return(result);
        }
        public async Task <Npc> Create(Npc Npc)
        {
            var result = await Task.FromResult(_dapper.Insert <Npc>("insert into Npc(NpcName, IsMerchant, GivesQuests)" +
                                                                    $" values('{Npc.NpcName}', {(Npc.IsMerchant ? 1 : 0)}, {(Npc.GivesQuests ? 1 : 0)})",
                                                                    null, commandType: CommandType.Text));

            return(result);
        }
Ejemplo n.º 6
0
        public int Insert(UserModel user)
        {
            var sql        = "INSERT INTO public.user(email, password) VALUES(@email, @password)";
            var parameters = user;

            var id = _postgreSQL.Insert(sql, parameters);

            return(id);
        }
Ejemplo n.º 7
0
        public int Insert(FavoriteModel favorite)
        {
            var sql        = "INSERT INTO public.favorited(recipe_id, favorited_title, user_id) VALUES(@recipe_id, @favorited_title, @user_id)";
            var parameters = favorite;

            var id = _postgreSQL.Insert(sql, parameters);

            return(id);
        }
Ejemplo n.º 8
0
        public Task <int> Create(Teams team)
        {
            var dbParameters = new DynamicParameters();

            dbParameters.Add("Name", team.Name, DbType.String);
            dbParameters.Add("Category", team.Category, DbType.String);

            var teamId = Task.FromResult(_dapperService.Insert <int>("[dbo].[Teams]", dbParameters, commandType: CommandType.StoredProcedure));

            return(teamId);
        }
        public int Create(EventDto Event)
        {
            var result = _dapper.Insert <int>(
                "insert into Event(EventSummary, EventAlreadyEncountered, EventPassed, MonsterId, ItemId, ZoneId)"
                + " values(@EventSummary, @EventAlreadyEncountered, @EventPassed, @MonsterId, @ItemId, @ZoneId);"
                + " select cast(scope_identity() as int)",
                //+ $" values('{Event.EventSummary}', {(Event.EventAlreadyEncountered ? 1 : 0)}, {(Event.EventPassed ? 1 : 0)}, {Event.Monster?.MonsterId.ToString() ?? "null"}, "
                //+ $"{Event.Item?.ItemId.ToString() ?? "null"}, {Event.Zone.ZoneId})",
                new DynamicParameters(Event), commandType: CommandType.Text);

            return(result);
        }
Ejemplo n.º 10
0
        public async Task <int> Create(Player data)
        {
            var dbparams = new DynamicParameters();

            dbparams.Add("PlayerName", data.PlayerName, DbType.String);
            dbparams.Add("Level", data.Level, DbType.Int32);
            dbparams.Add("Health", data.Health, DbType.Int32);
            dbparams.Add("MaxHealth", data.MaxHealth, DbType.Int32);
            dbparams.Add("Strength", data.Strength, DbType.Int32);
            dbparams.Add("Defense", data.Defense, DbType.Int32);
            dbparams.Add("Gold", data.PlayerId, DbType.Int32);
            dbparams.Add("Experience", data.Experience, DbType.Int32);
            dbparams.Add("CurrentZoneId", data.CurrentZone.ZoneId, DbType.Int32);
            var result = await Task.FromResult(_dapper.Insert <int>("[dbo].[SP_Create_Player]"
                                                                    , dbparams,
                                                                    commandType: CommandType.StoredProcedure));

            return(result);
        }
        public async Task <Zone> Create(Zone zone)
        {
            var result = await Task.FromResult(_dapper.Insert <Zone>($"insert into Zone(ZoneName) values ('{zone.ZoneName}')", null, commandType: CommandType.Text));

            return(result);
        }