Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ImagePath")] Info info)
        {
            if (id != info.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(info);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InfoExists(info.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(info));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Img,Price,Weight,Description,RoastLevel,Taste,RoastDate")] Coffee coffee)
        {
            if (id != coffee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(coffee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CoffeeExists(coffee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(coffee));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,NamaKopi,AsalKopi,JenisKopi,DeskripsiKopi")] Coffee coffee)
        {
            if (id != coffee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(coffee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CoffeeExists(coffee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(coffee));
        }