以下のコードで 2 つのテーブルを埋めることができますか? Address 、 Cod 、Cost は tbl_Reciver に入力する必要があります。ただし、 Lname 、 Name 、 Tell は Tbl_Sender に入力する必要があります。ここに 2 つのテーブルを記入できますか?
public static bool InsertInTables(string Address, string Cod, int? cost,string Lname, string Name, string Tell )
{
MyContext db = new MyContext();
try
{
//Can i fill Tbl_Sender like tbl_Reciver here
var tbl1 = new tbl_Reciver
{
id = MaxIdInTbl (),
Address_s = Address,
Cod_s = Cod,
Cost_s = cost,
//i wanna fill below fields in tbl_Sender
// Lname_s = Lname,
// Name_s = Name,
//Tell_s = Tell,
};
//is it possible i fill two tables ?
db.tbl_Reciver.Add(tbl1);
db.SaveChanges();
return true;
}
catch
{
return false;
}
}