public async Task <ActionResult <IEnumerable <SchuelerModel> > > GetSchuelers()
        {
            try
            {
                //var x = conString;
                var data = await SchuelerProcessor.LoadSchuelerAsync(ConnectionString);

                List <SchuelerModel> ViewListeSchueler = new List <SchuelerModel>();

                foreach (var item in data)
                {
                    ViewListeSchueler.Add(
                        new SchuelerModel()
                    {
                        Checkpersonnumber = item.Checkpersonnumber,
                        NName             = item.NName,
                        VName             = item.VName,
                        EmailAdresse      = item.EmailAdresse,
                        Geschlecht        = item.Geschlecht,
                        Schuljahr         = item.Schuljahr
                    });
                }
                return(ViewListeSchueler);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 2
0
        // GET: Schueler
        public async Task <IActionResult> Index()
        {
            var s = User;

            try
            {
                var data = await SchuelerProcessor.LoadSchuelerAsync(ConnectionString);

                List <SchuelerModel> ViewListeSchueler = new List <SchuelerModel>();

                foreach (var item in data)
                {
                    ViewListeSchueler.Add(
                        new SchuelerModel()
                    {
                        Checkpersonnumber = item.Checkpersonnumber,
                        NName             = item.NName,
                        VName             = item.VName,
                        EmailAdresse      = item.EmailAdresse,
                        Geschlecht        = item.Geschlecht,
                        Schuljahr         = item.Schuljahr
                    });
                }

                return(View(ViewListeSchueler));
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }