C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,925 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have this method and it's output
var lista = allPerson.Select(c => new { c.Id, c.Smstext , c.Mobile}).ToList();
I want to insert into a table with bellow properties :
TblMessageBranch tblMessage = new TblMessageBranch()
{
PID = ,
MessageText = ,
SendingTime = DateTime.Now,
Address = ,
ProviderId = 49,
IsTransferred = false,
MessageDate = ,
MessageType = smsTypeSelect
};
I do not know how to use the output of above method into this table ?
You can do something like this:
List<TblMessageBranch> messages =
lista.Select( p =>
new TblMessageBranch
{
PID = p.Id,
MessageText = p.Smstext,
SendingTime = DateTime.Now,
Address = ???, // maybe 'p.Mobile'?
ProviderId = 49,
IsTransferred = false,
MessageDate = ???, // maybe 'DateTime.Now'?
MessageType = smsTypeSelect
} ).ToList( );
It is not clear how to get some of the fields.