public BlockChainService(BlockService blockService, IServiceProvider serviceProvider, BlockchainContext dbContext) { _blockService = blockService; _serviceProvider = serviceProvider; _dbContext = dbContext; }
public IActionResult AddUser(IFormCollection fc) { string name = fc["name"]; string account = fc["account"]; string password = fc["password"]; BlockchainContext db = new BlockchainContext(); User user = new User { Name = name, Account = account, Password = password, }; db.User.Add(user); int number = db.SaveChanges(); if (number == 1) { return(RedirectToAction("Index")); } else { return(View("Add")); } }
public IActionResult Index() { BlockchainContext db = new BlockchainContext(); var res = (from x in db.Game select x).ToList(); ViewBag.games = res; return(View()); }
public VotingService(BlockchainContext dbContext, WalletService walletService, MinerService minerService, P2PNetwork p2PNetwork) { _dbContext = dbContext; _walletService = walletService; _minerService = minerService; _p2PNetwork = p2PNetwork; }
public IActionResult GameManagement() { BlockchainContext db = new BlockchainContext(); var res = (from x in db.Game select x).ToList(); ViewBag.games = res; //動態 return(View()); }
public IActionResult GameEdit(int id) { BlockchainContext db = new BlockchainContext(); var res = (from x in db.Game where x.Id == id select x).FirstOrDefault(); ViewBag.game = res; return(View()); }
public IActionResult GameEditPost(IFormCollection fc) { int id = int.Parse(fc["id"]); string name = fc["name"]; string description = fc["description"]; BlockchainContext db = new BlockchainContext(); var res = (from x in db.Game where x.Id == id select x).FirstOrDefault(); res.Name = name; res.Description = description; db.SaveChanges(); return(Redirect("/Game")); }
public IActionResult Delete(int id) { BlockchainContext db = new BlockchainContext(); var res = (from x in db.Game where x.Id == id select x).FirstOrDefault(); if (res == null) { return(Content("Miss data")); } else { db.Game.Remove(res); db.SaveChanges(); return(Content("ok")); } }
public IActionResult UserEditPost(IFormCollection fc) { int id = int.Parse(fc["id"]); string name = fc["name"]; string account = fc["account"]; string password = fc["password"]; BlockchainContext db = new BlockchainContext(); var res = (from x in db.User where x.Id == id select x).FirstOrDefault(); res.Name = name; res.Account = account; res.Password = password; db.SaveChanges(); return(Redirect("/User")); }
public IActionResult AddGame(IFormCollection fc) { string name = fc["name"]; string description = fc["description"]; BlockchainContext db = new BlockchainContext(); Game game = new Game { Name = name, Description = description }; db.Game.Add(game); int number = db.SaveChanges(); if (number == 1) { return(RedirectToAction("Index")); } else { return(View("Add")); } }
public IActionResult Game() { BlockchainContext db = new BlockchainContext(); return(View()); }
public TransactionPoolService(TransactionService transactionService, BlockchainContext dbContext) { _transactionService = transactionService; _dbContext = dbContext; }
public ElectionService(BlockchainCommonContext commonDbContext, BlockchainContext dbContext, IMapper mapper) { _commonDbContext = commonDbContext; _dbContext = dbContext; _mapper = mapper; }
public WalletService(TransactionService transactionService, BlockchainContext dbContext, TransactionPoolService transactionPool) { _transactionService = transactionService; _dbContext = dbContext; _transactionPool = transactionPool; }
public TransactionService(BlockchainContext dbContext) { _dbContext = dbContext; }
public PackageRepository(BlockchainContext blockchainContext) { _blockchainContext = blockchainContext; }
public SqlBlockLayer(BlockchainContext context) { _context = context; }