public async Task <ActionResult> UpdateWorker(int id) { var pools = await PoolReader.GetPools(); var worker = await PoolWorkerReader.AdminGetWorker(User.Identity.GetUserId(), id); var poolconnection = await PoolReader.GetPoolConnection(worker.AlgoType); return(View("UpdateWorkerModal", new AdminPoolWorkerUpdateModel { Id = id, Name = worker.Name, AlgoType = worker.AlgoType, IsAutoSwitch = worker.IsAutoSwitch, Password = worker.Password, TargetDifficulty = worker.TargetDifficulty, DefaultDiff = poolconnection.DefaultDiff, FixedDiffSummary = poolconnection.FixedDiffSummary, VarDiffHighSummary = poolconnection.VarDiffHighSummary, VarDiffLowSummary = poolconnection.VarDiffLowSummary, VarDiffMediumSummary = poolconnection.VarDiffMediumSummary, DifficultyOption = PoolExtensions.TargetDifficultyToOption(worker.TargetDifficulty), TargetPool = worker.TargetPool, Pools = pools.Where(x => x.AlgoType == worker.AlgoType).OrderBy(x => x.Symbol).ToList() })); }
public async Task <ActionResult> UpdateConnection(AlgoType algoType) { var model = await PoolReader.GetPoolConnection(algoType); if (model == null) { return(ViewMessageModal(new ViewMessageModel(ViewMessageType.Danger, "Error", $"Connection #{algoType} not found"))); } var pools = await PoolReader.GetPools(); return(View("UpdatePoolConnectionModal", new AdminUpdatePoolConnectionModel { AlgoType = model.AlgoType, Host = model.Host, Name = model.Name, Port = model.Port, DefaultDiff = model.DefaultDiff, DefaultPool = model.DefaultPool, FixedDiffSummary = model.FixedDiffSummary, VarDiffHighSummary = model.VarDiffHighSummary, VarDiffLowSummary = model.VarDiffLowSummary, VarDiffMediumSummary = model.VarDiffMediumSummary, Pools = pools.Where(x => x.AlgoType == algoType).OrderBy(x => x.Symbol).ToList() })); }
public async Task <ActionResult> GettingStarted(int poolId) { var pool = await PoolReader.GetPool(poolId); var connection = await PoolReader.GetPoolConnection(pool.AlgoType); return(View("GettingStartedModal", new GettingStartedModel { PoolId = pool.Id, PoolName = pool.Name, PoolSymbol = pool.Symbol, AlgoType = pool.AlgoType, Port = connection.Port, StratumUrl = connection.Host })); }
public async Task <ActionResult> UpdateWorker(PoolWorkerUpdateModel model) { if (!ModelState.IsValid) { var poolconnection = await PoolReader.GetPoolConnection(model.AlgoType); model.FixedDiffSummary = poolconnection.FixedDiffSummary; model.VarDiffHighSummary = poolconnection.VarDiffHighSummary; model.VarDiffLowSummary = poolconnection.VarDiffLowSummary; model.VarDiffMediumSummary = poolconnection.VarDiffMediumSummary; return(View("UpdateWorkerModal", model)); } model.TargetDifficulty = PoolExtensions.OptionToTargetDifficulty(model.DifficultyOption, model.TargetDifficulty); var result = await PoolWorkerWriter.UpdateWorker(User.Identity.GetUserId(), model); if (!ModelState.IsWriterResultValid(result)) { return(View("UpdateWorkerModal", model)); } return(CloseModal(result)); }