public async Task <object> GET(ContactById request) { var response = new BaseResponse(); //Expression<Func<ServiceModel.Contact, bool>> keySelector = x => x.id == request.id; //var contactByID = await _contactService.GetById(keySelector, includeProperties:"Network"); //var dto = contactByID.ConvertTo<ContactDTO>(); //dto.NetworkName = contactByID.Network.nameNetwork; var contact = await _contactService.GetById(request.id); response.Results = contact; response.Message = $"Get contact by ID:{request.id} successfully"; return(response); }
public async Task <object> DELETE(ContactById request) { var response = new BaseResponse(); response.Results = await _contactService.Delete(request.id); if ((bool)response.Results == true) { response.Message = "Deleted contact successfully"; } else { response.Message = "Deleted contact failed"; } return(response); }
public override Task <ContactResponse> GetContactById(ContactById request, ServerCallContext context) { return(Task.FromResult(_Contacts.FirstOrDefault(c => c.Id == request.Id))); }