public bool LoginStatus(workerModel workerModelView) { try { workerModel newWorkerModelView = new workerModel(); newWorkerModelView = workerModelView; bool result = false; using (var dbContext = new StoreEntities()) { var grabAccQuery = (from a in dbContext.workerAccounts where a.username == newWorkerModelView.usernameInput && a.password == newWorkerModelView.passwordInput select a).FirstOrDefault(); if (grabAccQuery != null) { result = true; return(result); } else { return(result); } } } catch (Exception ex) { throw ex; } }
public workerModel returnWorkerID() { workerModel newWorkerModel = new workerModel(); using (var dbContext = new StoreEntities()) { var firstNM = (from w in dbContext.workerInfoes select w.firstNM).FirstOrDefault(); newWorkerModel.worker_firstNM = firstNM; return(newWorkerModel); } }
public List <workerModel> getAccounts() { List <workerModel> newWorkerList = new List <workerModel>(); workerModel newWorkerModel = new workerModel(); using (var dbContext = new StoreEntities()) { var query = (from a in dbContext.workerAccounts select a).ToList(); foreach (var item in query) { var test = new workerModel { username = item.username, password = item.password }; newWorkerList.Add(test); } return(newWorkerList); } }