Exemple #1
0
        public async Task UpdateAsync(Domain.Models.Stock stock)
        {
            using var context = new mmpproject2Context(_contextOptions);
            var current = await context.Stocks.FirstAsync(s => s.Symbol == stock.Symbol && s.Market == stock.Market);

            var updated = Mapper.MapStock(stock);

            context.Entry(current).CurrentValues.SetValues(updated);

            await context.SaveChangesAsync();
        }
        public async Task UpdateAsync(Domain.Models.User user)
        {
            using var context = new mmpproject2Context(_contextOptions);
            var current = await context.Users.FindAsync(user.Id);

            var updated = Mapper.MapUser(user);

            context.Entry(current).CurrentValues.SetValues(updated);

            await context.SaveChangesAsync();
        }
Exemple #3
0
        public async Task UpdateAsync(Domain.Models.Asset asset)
        {
            using var context = new mmpproject2Context(_contextOptions);
            var current = await context.Assets.FirstAsync(a => a.Id == asset.Id);

            var updated = Mapper.MapAsset(asset);

            updated.PortfolioId = current.PortfolioId;
            context.Entry(current).CurrentValues.SetValues(updated);

            await context.SaveChangesAsync();
        }
        public async Task UpdateAsync(Domain.Models.Trade trade)
        {
            using var context = new mmpproject2Context(_contextOptions);
            var current = await context.Trades.FirstAsync(t => t.Id == trade.Id);

            var updated = Mapper.MapTrade(trade);

            updated.PortfolioId = current.PortfolioId;
            context.Entry(current).CurrentValues.SetValues(updated);

            await context.SaveChangesAsync();
        }
        public async Task UpdateAsync(Domain.Models.Portfolio portfolio)
        {
            using var context = new mmpproject2Context(_contextOptions);
            var current = await context.Portfolios.FindAsync(portfolio.Id);

            var updated = Mapper.MapPortfolio(portfolio);

            updated.UserId = current.UserId;
            context.Entry(current).CurrentValues.SetValues(updated);

            await context.SaveChangesAsync();
        }