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)); }