public async Task <ActionResult <Symptomer> > PostSymptomer(Symptomer symptomer)
        {
            _context.Symptomer.Add(symptomer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSymptomer", new { id = symptomer.Id }, symptomer));
        }
        public async Task <IActionResult> PutSymptomer(int id, Symptomer symptomer)
        {
            if (id != symptomer.Id)
            {
                return(BadRequest());
            }

            _context.Entry(symptomer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SymptomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,Alder,Køn,Region,SymptomerBool,Nyser,Hoster,Feber,Muskelømhed,Diarre,Opkast,Hovedpine,Halsonde,Stakåndethed,Udmattet,Sansetab,Andet")] Symptomer symptomer)
        {
            if (id != symptomer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(symptomer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SymptomerExists(symptomer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(symptomer));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,Date,Alder,Køn,Region,SymptomerBool,Nyser,Hoster,Feber,Muskelømhed,Diarre,Opkast,Hovedpine,Halsonde,Stakåndethed,Udmattet,Sansetab,Andet")] Symptomer symptomer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(symptomer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(symptomer));
        }
Пример #5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Symptomer = await _context.Symptomer.FirstOrDefaultAsync(m => m.Id == id);

            if (Symptomer == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Symptomer = await _context.Symptomer.FindAsync(id);

            if (Symptomer != null)
            {
                _context.Symptomer.Remove(Symptomer);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }