public ActionResult Index() { var msg = "No Db Connection"; var tableList = string.Empty; ViewBag.Message = "Your application home page."; try { var db = new DataContext(ConfigurationManager.ConnectionStrings["dockerdb"].ConnectionString); var textRepo = new ListsRepo(db); var returnText = textRepo.GetCount(); msg = "Db Connection OK"; } catch (Exception e) { msg = e.Message; } var vm = new TextViewModel { Description = msg }; return(View(vm)); }
public List <StudentLookUp> GetStudents(string keyword) { Check_StudendId(keyword); if (Errors.Count == 0) { ListsRepo repo = new ListsRepo(); return(repo.RetrieveStudentsList(keyword)); } return(null); }
private bool Check_StudendId(string keyword) { ListsRepo repo = new ListsRepo(); if (int.TryParse(keyword, out int i)) { string startdate = repo.getStudendStartDate(i.ToString()).ToString("yyyy"); Match m = Regex.Match(i.ToString(), $"{startdate}[0-9][0-9][0-9][0-9]"); if (!m.Success) { Errors.Add(new ValidationError("Invalid StudendId")); return(false); } return(true); } return(true); }
public List <StudentLookup> GetStudent(string Lname = "", string id = "") { ListsRepo repo = new ListsRepo(); return(repo.RetrieveStudentsList(Lname, id)); }
public List <LoanLookUp> GetLoans(string id) { ListsRepo repo = new ListsRepo(); return(repo.RetrieveLoanList(id)); }