Example #1
0
            public bool DeleteBlackMarketListing(long listingId)
            {
                Maple2.Sql.Model.BlackMarketListing listing = context.BlackMarketListing.Find(listingId);
                if (listing == null)
                {
                    return(false);
                }

                context.Remove(listing);
                return(context.TrySaveChanges());
            }
Example #2
0
            /* Write */
            public long CreateBlackMarketListing(BlackMarketListing listing)
            {
                var dbListing = new Maple2.Sql.Model.BlackMarketListing();

                // Perform lookup for item if it exists, so we UPDATE instead of ADD
                dbListing.Item         = context.Item.Find(listing.Item.Id) ?? new Maple2.Sql.Model.Item();
                dbListing.Item.OwnerId = 100; // 100 = BlackMarket

                storage.blackMarketListingConverter.ToModel(listing, dbListing);
                context.BlackMarketListing.Add(dbListing);
                return(context.TrySaveChanges() ? dbListing.Id : -1);
            }