public async Task <ActionResult <Klopapier> > PostKlopapier(Klopapier klopapier) { _context.Klopapier.Add(klopapier); await _context.SaveChangesAsync(); return(CreatedAtAction("GetKlopapier", new { id = klopapier.Id }, klopapier)); }
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)); }
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()); }
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)); }