public override Task <Empty> DeleteCompanyDescription(CompDescArray request, ServerCallContext context) { var pocos = ProtoToPoco(request); _logic.Delete(pocos.ToArray()); return(new Task <Empty>(() => new Empty())); }
public List <CompanyDescriptionPoco> ProtoToPoco(CompDescArray request) { List <CompanyDescriptionPoco> pocos = new List <CompanyDescriptionPoco>(); var inputList = request.CompDesc.ToList(); foreach (var item in inputList) { var poco = new CompanyDescriptionPoco(); poco.Id = Guid.Parse(item.Id); poco.Company = Guid.Parse(item.Company); poco.LanguageId = item.LanguageId; poco.CompanyName = item.CompanyName; poco.CompanyDescription = item.CompanyDescription; pocos.Add(poco); } return(pocos); }
public override Task <CompDescArray> GetAllCompanyDescription(Empty request, ServerCallContext context) { List <CompanyDescriptionPoco> pocos = _logic.GetAll(); List <CompDescProto> compDescList = new List <CompDescProto>(); foreach (var poco in pocos) { CompDescProto compDesc = new CompDescProto(); compDesc.Id = poco.Id.ToString(); compDesc.Company = poco.Company.ToString(); compDesc.LanguageId = poco.LanguageId; compDesc.CompanyName = poco.CompanyName; compDesc.CompanyDescription = poco.CompanyDescription; compDescList.Add(compDesc); } CompDescArray compDescArray = new CompDescArray(); compDescArray.CompDesc.AddRange(compDescList); return(new Task <CompDescArray>(() => compDescArray)); }