Пример #1
0
        public List <ProblemViewModel> GetAll()
        {
            List <ProblemViewModel> allVms = new List <ProblemViewModel>();

            try
            {
                List <Problem> allProblems = _model.GetAll();

                foreach (Problem prob in allProblems)
                {
                    ProblemViewModel probVm = new ProblemViewModel();
                    probVm.Id          = prob.Id;
                    probVm.Timer       = Convert.ToBase64String(prob.Timer);
                    probVm.Description = prob.Description;
                    allVms.Add(probVm);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name +
                                  " " + ex.Message);
                throw ex;
            }

            return(allVms);
        }
        public List <ProblemViewModel> GetAll()
        {
            // Create a list to hold the ProblemViewModell objects
            List <ProblemViewModel> allVms = new List <ProblemViewModel>();

            try
            {
                // Create the List to hold the Employee objects. Uses the GetAll()
                // from the EmployeeModel class to populate this List
                List <Problem> allProblems = _model.GetAll();

                // For each Employee in the allEmployees List create a view model for them and
                // then add them to the List of Employee objects
                foreach (Problem problem in allProblems)
                {
                    ProblemViewModel probVm = new ProblemViewModel();
                    probVm.Id          = problem.Id;
                    probVm.Description = problem.Description;
                    //probVm.Timer = Convert.ToBase64String(problem.Timer);
                    allVms.Add(probVm);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " +
                                  MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }

            // Return the List of EmployeeViewModel objects
            return(allVms);
        }
Пример #3
0
        //Retrieve a list of problem view models constructed from all the problems in the database
        public List <ProblemViewModel> GetAll()
        {
            List <ProblemViewModel> allVms = new List <ProblemViewModel>();

            try
            {
                //Get a list of all problems
                List <Problem> problems = _model.GetAll();
                foreach (Problem prb in problems)
                {
                    ProblemViewModel pvm = new ProblemViewModel();
                    pvm.Id          = prb.Id;
                    pvm.Description = prb.Description;
                    allVms.Add(pvm);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }
            return(allVms);
        }
Пример #4
0
        public List <ProblemViewModel> GetAll()
        {
            List <ProblemViewModel> allpro = new List <ProblemViewModel>();

            try
            {
                List <Problem> pros = _model.GetAll();
                foreach (Problem pr in pros)
                {
                    ProblemViewModel pro = new ProblemViewModel();
                    pro.Id          = pr.Id;
                    pro.Description = pr.Description;
                    allpro.Add(pro);
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }

            return(allpro);
        }
Пример #5
0
        public List <ProblemViewModel> GetAll()
        {
            List <ProblemViewModel> allVms = new List <ProblemViewModel>();

            try
            {
                List <Problem> problems = _model.GetAll();

                foreach (Problem p in problems)
                {
                    ProblemViewModel VM = new ProblemViewModel();
                    VM.Id          = p.Id;
                    VM.Description = p.Description;
                    VM.Timer       = Convert.ToBase64String(p.Timer);
                    allVms.Add(VM);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
            }

            return(allVms);
        }