예제 #1
0
        public async Task <ActionResult <Klopapier> > PostKlopapier(Klopapier klopapier)
        {
            _context.Klopapier.Add(klopapier);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetKlopapier", new { id = klopapier.Id }, klopapier));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AnzahlBlatt,Hersteller,Produkt,Langen,Duft")] Klopapier klopapier)
        {
            if (id != klopapier.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(klopapier);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KlopapierExists(klopapier.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(klopapier));
        }
예제 #3
0
        public async Task <IActionResult> PutKlopapier(int id, Klopapier klopapier)
        {
            if (id != klopapier.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("Id,AnzahlBlatt,Hersteller,Produkt,Langen,Duft")] Klopapier klopapier)
        {
            if (ModelState.IsValid)
            {
                _context.Add(klopapier);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(klopapier));
        }