public async Task <IEnumerable <BrushingInformation> > Get(bool?latest, string userId) { Expression <Func <BrushingInformation, bool> > match = (x) => x.UserId == userId; if (latest == true) { match = (x) => x.UserId == userId && x.BrushingDate == DateTime.Now.ToUniversalTime().Date; } return(await _mongoUnitOfWork.GetAllAsync(collectionName, match).ConfigureAwait(false)); }
public async Task SendOilFundPriceNoti() { //Get Line User var data = await _mongoUnitOfWork.GetAllAsync <LineUsers>("LineUsers", x => true).ConfigureAwait(false); string[] users = data.Select(x => x.UserId).Distinct().ToArray(); //Get Oil Price var doc = await _webScraper.GetPageData("https://www.kasikornasset.com/th/mutual-fund/fund-template/Pages/K-OIL.aspx").ConfigureAwait(false); if (doc.DocumentElement.OuterHtml.Length > 0) { var oil_List_Today = doc.All.Where(m => m.LocalName == "td" && m.ClassName == "td-val nowrap a-center v-middle").ToList(); var diff = Convert.ToDouble(oil_List_Today[2].TextContent) - Convert.ToDouble(oil_List_Today[7].TextContent); string text = $"ราคากองทุน k-oil วันที่ {oil_List_Today[0].TextContent} \nราคา {oil_List_Today[1].TextContent} \nราคาแตกต่าง {diff:0.##} {StringHelper.GetCodePoint("0x100080")}"; foreach (var user in users) { await _lineMessageService.SendTextMessage(user, new string[] { text }).ConfigureAwait(false); } } }
public async Task <IEnumerable <SET> > GetSET() { var data = await _mongoUnitOfWork.GetAllAsync <SET>(collectionName, _ => true).ConfigureAwait(false); return(data); }
public async Task <IEnumerable <SleepInformation> > Get(Expression <Func <SleepInformation, bool> > match) { return(await _mongoUnitOfWork.GetAllAsync(collectionName, match).ConfigureAwait(false)); }