public override Task <Empty> DeleteSystemCountryCode(SysCountryCodeArray request, ServerCallContext context) { var pocos = ProtoToPoco(request); _logic.Delete(pocos.ToArray()); return(new Task <Empty>(() => new Empty())); }
public List <SystemCountryCodePoco> ProtoToPoco(SysCountryCodeArray request) { List <SystemCountryCodePoco> pocos = new List <SystemCountryCodePoco>(); var inputList = request.SysCountryCode.ToList(); foreach (var item in inputList) { var poco = new SystemCountryCodePoco(); poco.Code = item.Code; poco.Name = item.Name; pocos.Add(poco); } return(pocos); }
public override Task <SysCountryCodeArray> GetAllSystemCountryCode(Empty request, ServerCallContext context) { List <SystemCountryCodePoco> pocos = _logic.GetAll(); List <SysCountryCodeProto> sysCountryCodeList = new List <SysCountryCodeProto>(); foreach (var poco in pocos) { SysCountryCodeProto sysCountryCode = new SysCountryCodeProto(); sysCountryCode.Code = poco.Code; sysCountryCode.Name = poco.Name; sysCountryCodeList.Add(sysCountryCode); } SysCountryCodeArray sysCountryCodeArray = new SysCountryCodeArray(); sysCountryCodeArray.SysCountryCode.AddRange(sysCountryCodeList); return(new Task <SysCountryCodeArray>(() => sysCountryCodeArray)); }