Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,FirstName,LastName")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    //if (!UserExists(user.Id))
                    //{
                    //    return NotFound();
                    //}
                    //else
                    //{
                    //    throw;
                    //}
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Location,ActiveCashiers,MaxCapacity")] Shop shop)
        {
            if (id != shop.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShopExists(shop.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shop));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OwnerId,ShopId,BookingTime,BookingState")] Booking booking)
        {
            if (id != booking.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(booking));
        }