public void Test2() { JT808BlacklistManager jT808BlacklistManager = new JT808BlacklistManager(); jT808BlacklistManager.Add("1"); jT808BlacklistManager.Add("2"); Assert.True(jT808BlacklistManager.Contains("1")); Assert.True(jT808BlacklistManager.Contains("2")); }
public ActionResult <JT808ResultDto <bool> > BlacklistAdd([FromBody] JT808TerminalPhoneNoDto parameter) { JT808ResultDto <bool> resultDto = new JT808ResultDto <bool>(); try { BlacklistManager.Add(parameter.TerminalPhoneNo); resultDto.Code = JT808ResultCode.Ok; resultDto.Data = true; } catch (Exception ex) { resultDto.Data = false; resultDto.Code = JT808ResultCode.Error; resultDto.Message = ex.StackTrace; } return(resultDto); }
/// <summary> /// 添加sim卡黑名单 /// </summary> /// <param name="json"></param> /// <returns></returns> public byte[] BlacklistAdd(string json) { if (string.IsNullOrEmpty(json)) { return(EmptyHttpResponse()); } JT808ResultDto <bool> resultDto = new JT808ResultDto <bool>(); try { BlacklistManager.Add(json); resultDto.Data = true; resultDto.Code = JT808ResultCode.Ok; } catch (Exception ex) { resultDto.Data = false; resultDto.Code = JT808ResultCode.Error; resultDto.Message = ex.StackTrace; } return(CreateHttpResponse(resultDto)); }
/// <summary> /// 添加sim卡黑名单 /// </summary> /// <param name="json"></param> /// <returns></returns> public byte[] BlacklistAdd(string json) { if (string.IsNullOrEmpty(json)) { return(EmptyHttpResponse()); } JT808ResultDto <bool> resultDto = new JT808ResultDto <bool>(); try { JT808TerminalPhoneNoDto parameter = JsonSerializer.Deserialize <JT808TerminalPhoneNoDto>(json); BlacklistManager.Add(parameter.TerminalPhoneNo); resultDto.Data = true; resultDto.Code = JT808ResultCode.Ok; } catch (Exception ex) { resultDto.Data = false; resultDto.Code = JT808ResultCode.Error; resultDto.Message = ex.StackTrace; } return(CreateHttpResponse(resultDto)); }