EF core

Scaffold-DbContext "server=192.168.0.001;database=xxx;user id=sa;password=xxx;" 
Microsoft.EntityFrameworkCore.SqlServer -Tables TabManager -OutputDir DbModels11

 

//查詢體溫
                var accounttw = await _concardContext.TabRecord
                    .GroupJoin(_concardContext.WxTemperature, t1 => t1.AccountNo, t2 => t2.Accountno,
                        (t1, t2) => new
                        {
                            t1.Name,
                            t1.Depart,
                            Temperature = t2
                        })
                   .SelectMany(a => a.Temperature.DefaultIfEmpty(), (a, b) => new
                   {
                       a.Name,
                       a.Depart,
                       Bodytemperaturet = b.Pushtime.Date == model.datetime.Date ? b.Bodytemperature : "",
                       Pushtime = b.Pushtime.Date == model.datetime.Date ? b.Pushtime.ToString("HH:mm:ss MM月dd日") : "",
                   })
                    .Where(w => w.Depart == model.DepList)
                    .ToListAsync();

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章