Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Username,Password,Email,Created,LastUpdate,LastLog,IdDevice")] 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)));
            }
            ViewData["IdDevice"] = new SelectList(_context.Devices, "IdDevice", "DeviceName", user.IdDevice);
            return(View(user));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdPlace,AddressId,Description,Price,Availability,Rooms,MaxOfGuests")] Place place)
        {
            if (id != place.IdPlace)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(place);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlaceExists(place.IdPlace))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddressId"] = new SelectList(_context.Addresses, "IdAddress", "IdAddress", place.AddressId);
            return(View(place));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("IdAddress,Country,City,Number")] Address address)
        {
            if (id != address.IdAddress)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(address);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AddressExists(address.IdAddress))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("IdReview,OfferId,UserRoleId,Date,RatingId,Comment")] Review review)
        {
            if (id != review.IdReview)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(review);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReviewExists(review.IdReview))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OfferId"]  = new SelectList(_context.Offers, "IdOffer", "IdOffer", review.OfferId);
            ViewData["RatingId"] = new SelectList(_context.Ratings, "IdRating", "IdRating", review.RatingId);
            return(View(review));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdRating,HostRate,Communication,Location,Value,Accuracy,Cleanliness")] Rating rating)
        {
            if (id != rating.IdRating)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rating);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RatingExists(rating.IdRating))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rating));
        }
Beispiel #6
0
        public async Task <IActionResult> Edit(int id, [Bind("IdRent,CheckIn,CheckOut")] Rent rent)
        {
            if (id != rent.IdRent)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RentExists(rent.IdRent))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rent));
        }
Beispiel #7
0
        public async Task <IActionResult> Edit(int id, [Bind("IdSpecs,Created,Updated,Description,Amenities")] Spec spec)
        {
            if (id != spec.IdSpecs)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(spec);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpecExists(spec.IdSpecs))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(spec));
        }
Beispiel #8
0
        public async Task <IActionResult> Edit(int id, [Bind("IdRole,Name,Activity")] Role role)
        {
            if (id != role.IdRole)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(role);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoleExists(role.IdRole))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(role));
        }
Beispiel #9
0
        public async Task <IActionResult> Edit(int id, [Bind("IdURole,IdUser,IdRole")] UserRole userRole)
        {
            if (id != userRole.IdURole)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userRole);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserRoleExists(userRole.IdURole))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdRole"] = new SelectList(_context.Roles, "IdRole", "Name", userRole.IdRole);
            return(View(userRole));
        }
Beispiel #10
0
        public async Task <IActionResult> Edit(int id, [Bind("IdOffer,PlaceId,RentId,UserRoleId,Date")] Offer offer)
        {
            if (id != offer.IdOffer)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(offer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OfferExists(offer.IdOffer))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlaceId"]    = new SelectList(_context.Places, "IdPlace", "IdPlace", offer.PlaceId);
            ViewData["RentId"]     = new SelectList(_context.Rents, "IdRent", "IdRent", offer.RentId);
            ViewData["UserRoleId"] = new SelectList(_context.UserRoles, "IdURole", "IdURole", offer.UserRoleId);
            return(View(offer));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdDevice,DeviceName,Description")] Device device)
        {
            if (id != device.IdDevice)
            {
                return(NotFound());
            }

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