Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 471.8k

Using lamba expression to query for data type?

Nov 9 2021 7:14 AM

Hi team

 

I have an object(Time) and its data type i set it on Time(7) on local database and entity model called DateTime. Now how do i change it to allow it to have access to my lamba experession? See my method when im calling it.

 

   public List GetIncident_Details()
        {
            Entities incident = new Entities();
            List result = new List();


            var c_incident = incident.Incident_Template.Select(c => c).ToList();
            if (c_incident != null && c_incident.Count() > 0)
            {
                foreach (var cData in c_incident)
                {
                    Incident_DropDown model = new Incident_DropDown();
                    model.Title = cData.Title;
                    model.Description = cData.Description;
                    model.Date_Occured = cData.Date_Occured;
                    model.Time = cData.Time; // How do i change this to have access? Its complaining about the data type object as being set to string....?
                    model.Assignment_Group = cData.Assignment_Group;
                    model.Reported_CI = cData.Reported_CI;


                    result.Add(model);
                }
            }
            return result;
        }

 

 public class Incident_DropDown
    {
        public string Title { get; set; }


        public string Description { get; set; }


        public string Date_Occured { get; set; }

        public DateTime Time { get; set; } // Time

        public string Assignment_Group { get; set; }


        public string Reported_CI { get; set; }

    }


Answers (1)