示例#1
0
        public async Task <IActionResult> PutGericht(int id, Gericht gericht)
        {
            if (id != gericht.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Name,Preis,KCal,Vegetarisch,Id,Created,Modified")] Gericht gericht)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gericht);
                await _context.SaveChangesAsync();

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