public IActionResult SearchYoubikeLog() { YoubikeLogFinderModel model = new YoubikeLogFinderModel(); model.stationList = _dBHelpers.GetYouBikeStationList() .Select(n => new SelectListItem() { Text = n.SNA, Value = n.SNO }).ToList(); model.regionList = _dBHelpers.GetRegionList().Select(n => new SelectListItem() { Text = n.AREANAME, Value = n.AREANAME }).ToList(); return(View(model)); }
public YoubikeLogListViewModel GetYouBikeLogList(YoubikeLogFinderModel data) { YoubikeLogListViewModel youBikeLogList = new YoubikeLogListViewModel(); try { using (var conn = new NpgsqlConnection(YouBikeDBConnectionString)) { string sql = @" SELECT logid, yl.sno, sna, sarea, sbi, mday, bemp, updatedatetime FROM youbikelog yl LEFT JOIN youbikestation ys ON yl.sno = ys.sno "; string wheresql = string.Empty; if (!string.IsNullOrWhiteSpace(data.Sno)) { wheresql = string.Concat(wheresql, "yl.sno = @sno"); } if (!string.IsNullOrWhiteSpace(data.Sarea)) { wheresql = string.Concat(wheresql, (string.IsNullOrWhiteSpace(wheresql) ? string.Empty : " AND "), "ys.sarea = @Sarea"); } if (wheresql.Length > 0) { sql = string.Concat(sql, " WHERE ", wheresql); youBikeLogList.YoubikeLogList = conn.Query <YouBikeLogViewModel>(sql, data).ToList(); } else { youBikeLogList.YoubikeLogList = conn.Query <YouBikeLogViewModel>(sql).ToList(); } } } catch (Exception ex) { _logger.LogError(ex.Message); } return(youBikeLogList); }
public List <YouBikeLogViewModel> GetYoubikeLogList([FromBody] YoubikeLogFinderModel model) { YoubikeLogListViewModel YouBikeLogListModel = _dBHelpers.GetYouBikeLogList(model); return(YouBikeLogListModel.YoubikeLogList); }
public IActionResult YoubikeLogList(YoubikeLogFinderModel model) { YoubikeLogListViewModel YouBikeLogListModel = _dBHelpers.GetYouBikeLogList(model); return(PartialView("_YoubikeLogList", YouBikeLogListModel)); }