public override Task <Empty> DeleteSecurityLoginsLog(SecLoginsLogArray request, ServerCallContext context) { var pocos = ProtoToPoco(request); _logic.Delete(pocos.ToArray()); return(new Task <Empty>(() => new Empty())); }
public List <SecurityLoginsLogPoco> ProtoToPoco(SecLoginsLogArray request) { List <SecurityLoginsLogPoco> pocos = new List <SecurityLoginsLogPoco>(); var inputList = request.SecLoginsLog.ToList(); foreach (var item in inputList) { var poco = new SecurityLoginsLogPoco(); poco.Id = Guid.Parse(item.Id); poco.Login = Guid.Parse(item.Login); poco.SourceIP = item.SourceIP; poco.LogonDate = item.LogonDate.ToDateTime(); poco.IsSuccesful = item.IsSuccesful; pocos.Add(poco); } return(pocos); }
public override Task <SecLoginsLogArray> GetAllSecurityLoginsLog(Empty request, ServerCallContext context) { List <SecurityLoginsLogPoco> pocos = _logic.GetAll(); List <SecLoginsLogProto> secLoginsLogList = new List <SecLoginsLogProto>(); foreach (var poco in pocos) { SecLoginsLogProto secLoginsLog = new SecLoginsLogProto(); secLoginsLog.Id = poco.Id.ToString(); secLoginsLog.Login = poco.Login.ToString(); secLoginsLog.SourceIP = poco.SourceIP; secLoginsLog.LogonDate = Timestamp.FromDateTime(poco.LogonDate); secLoginsLog.IsSuccesful = poco.IsSuccesful; secLoginsLogList.Add(secLoginsLog); } SecLoginsLogArray secLoginsLogArray = new SecLoginsLogArray(); secLoginsLogArray.SecLoginsLog.AddRange(secLoginsLogList); return(new Task <SecLoginsLogArray>(() => secLoginsLogArray)); }