Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }