public void VerifyBlock(VerifyBlockModel verifyBlock) { var block = _unitOfWork.Repository<BlockEntity>().Include(x => x.Verifications) .FirstOrDefault(x => x.Hash == verifyBlock.Id); if (block != null) { block.Verifications.Add(new BlockVerificationEntity { UserPublicKey = verifyBlock.User }); _unitOfWork.SaveChanges(); if (block.Verifications.Count >= _options.Value.VerificationNeeded) { block.BlockState = BlockState.Verified.ToString(); } _unitOfWork.SaveChanges(); } }
public IActionResult VerifyBlock([FromBody] VerifyBlockModel verifyBlock) { _blockService.VerifyBlock(verifyBlock); return(Ok()); }