示例#1
0
        public async Task <IActionResult> Create(NotenModel neuenote)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    await NotenProcessor.CreateNoteAsync(neuenote.NId, neuenote.Bezeichnung, neuenote.Mindestanforderung, ConnectionString);
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#2
0
        public async Task <bool> PostNote(NotenModel note)
        {
            try
            {
                var b = await NotenProcessor.CreateNoteAsync(
                    note.NId,
                    note.Bezeichnung,
                    note.Mindestanforderung,
                    ConnectionString);

                return(b);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#3
0
        public async Task <NotenModel> GetNoteAsync(int id)
        {
            try
            {
                NotenDLModel resultnote = await NotenProcessor.GetByIdNoteAsync(id, ConnectionString);

                NotenModel note =
                    new NotenModel
                {
                    NId                = resultnote.NId,
                    Bezeichnung        = resultnote.Bezeichnung,
                    Mindestanforderung = resultnote.Mindestanforderung
                };

                return(note);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }