public ListMortgageLoanResponse GetLoanByEmail(string email) { ListMortgageLoanResponse response = new ListMortgageLoanResponse(); try { using (IDbConnection conn = GetConnection()) { response.applications = conn.Query <MortgageLoanApplication>(" SELECT * FROM hdldb.MortgageLoanApplication where Email= ?Email ", new { email }).ToList(); if (response.applications.Count > 0) { response.Status = true; response.Description = "Successful"; } else { response.Status = false; response.Description = "No data"; } } } catch (Exception ex) { response.Status = false; response.Description = ex.Message; } return(response); }
public ListMortgageLoanResponse GetLoanByUserID(long UserID) { ListMortgageLoanResponse response = new ListMortgageLoanResponse(); try { using (IDbConnection conn = GetConnection()) { response.applications = conn.GetList <MortgageLoanApplication>("where UserID = ?UserID", new { UserID }).ToList(); if (response.applications.Count > 0) { response.Status = true; response.Description = "Successful"; } else { response.Status = false; response.Description = "No data"; } } } catch (Exception ex) { response.Status = false; response.Description = ex.Message; } return(response); }
//DateTime? StartDate, DateTime? EndDate public ListMortgageLoanResponse List() { ListMortgageLoanResponse response = new ListMortgageLoanResponse(); try { using (IDbConnection conn = GetConnection()) { response.applications = conn.GetList <MortgageLoanApplication>().ToList(); //if (StartDate.HasValue && EndDate.HasValue) //{ // response.mortgageapplications = conn.GetList<MortgageApplication>("where convert(loandate, date) between convert(?StartDate, date) and convert(?EndDate, date)", new { StartDate, EndDate }).ToList(); //} //else //{ //} if (response.applications.Count > 0) { response.Status = true; response.Description = "Successful"; } else { response.Status = false; response.Description = "No data"; } } } catch (Exception ex) { response.Status = false; response.Description = ex.Message; } return(response); }