Hi,
may i know how to write the method in web service if i want to get a description from a particular id ?

public List<EventEntity> GetDetails(string uid)
        {
            EventDBModelDataContext ct = new EventDBModelDataContext();
            var detail = ct.EventEntities.Where(d => d.eventID==uid).Select(d => new { d.eventID, d.eventDesc });
                        
            return detail.ToList();

        }

Still having the error message: Cannot implicitly convert type 'System.Collections.Generic.List<AnonymousType#1>' to 'System.Collections.Generic.List<WcfEstateService2.EventEntity>' I:\vs\WcfEstateService2\WcfEstateService2\ServiceImpl.svc.cs

If you are planning to return the eventID and the eventDesc as an EventEntity, you will need to new them as an EventEntity.

Something like (JUST GUESSING):

public List<EventEntity> GetDetails(string uid)
{
   EventDBModelDataContext ct = new EventDBModelDataContext();

   List<EventEntity> detail = ct.EventEntities.Where(d => d.eventID.Equals(uid))
      .Select(d => new EventEntity(){ eventID=d.eventID, eventDesc=d.eventDesc })
      .ToList();
                        
   return detail;
}

...otherwise, you're getting back an anonymous type and those can't be "return"ed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.