Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("BookingID,CustomerID,TableID,BookingDate,BookedFrom,BookedUntil,PartySize")] Booking booking)
        {
            if (id != booking.BookingID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookingExists(booking.BookingID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(booking));
        }
        public async Task <IActionResult> Edit(short id, [Bind("Idservicos,Idhotel,Descricao")] ServicosHotel servicosHotel)
        {
            if (id != servicosHotel.Idservicos)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(servicosHotel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ServicosHotelExists(servicosHotel.Idservicos))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idhotel"] = new SelectList(_context.Hoteis, "Idhotel", "CodPostal", servicosHotel.Idhotel);
            return(View(servicosHotel));
        }
        public async Task <IActionResult> Edit(short id, [Bind("Idespecificacao,IdtipoQuarto,Descricao")] EspecificacoesQuarto especificacoesQuarto)
        {
            if (id != especificacoesQuarto.Idespecificacao)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(especificacoesQuarto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EspecificacoesQuartoExists(especificacoesQuarto.Idespecificacao))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdtipoQuarto"] = new SelectList(_context.TipoQuarto, "IdtipoQuarto", "Descricao", especificacoesQuarto.IdtipoQuarto);
            return(View(especificacoesQuarto));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ShowId,Date")] Performances performances)
        {
            if (id != performances.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(performances);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PerformancesExists(performances.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(performances));
        }
Esempio n. 5
0
        //Can be rented could be a solution to the point of a stolen book
        private static void UpdateBook(int id, string book, string author, int?year, IList <string> barcodes, BookingContext db)
        {
            var bookData = db.Books.FirstOrDefault(x => x.BookId == id);

            bookData.Name            = book;
            bookData.Author          = author;
            bookData.PublicationYear = year;

            db.Update(bookData);
            db.SaveChanges();

            var currentBarcodes = db.BooksCopies.Where(x => x.BookId == id).Select(x => x.Barcode).ToList();

            var newBarcodes = barcodes.Except(currentBarcodes).ToList();

            InsertBarcode(newBarcodes, id);

            var removedBarcodes = currentBarcodes.Except(barcodes).ToList();

            foreach (var barcode in removedBarcodes)
            {
                var booksCopiesId = db.BooksCopies.FirstOrDefault(x => x.Barcode == barcode).BooksCopiesId;
                if (db.ReservedBook.Count(x => x.BooksCopiesId == booksCopiesId) == 0)
                {
                    using var db2 = new BookingContext();
                    db2.Remove(new BooksCopies {
                        BooksCopiesId = booksCopiesId
                    });
                    db2.SaveChanges();
                }
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("CustomerID,FirstName,LastName,Mobile,Email")] Customer customer)
        {
            if (id != customer.CustomerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Esempio n. 7
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ResourceId,EventColor,Start,End,Title,StudentNumbers")] Events events)
        {
            if (id != events.Id)
            {
                //warning you can change the edit/ID in the task bar and save it back ss
                events.Id = id;
                //  return NotFound();
            }

            if (ModelState.IsValid && events.End > events.Start)
            {
                try
                {
                    _context.Update(events);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventsExists(events.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 8
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Telephone")] Staff staff)
        {
            if (id != staff.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffExists(staff.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(staff));
        }
Esempio n. 9
0
        public async Task <IActionResult> Edit(int id, [Bind("TableID,TableNumber")] Table table)
        {
            if (id != table.TableID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(table);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TableExists(table.TableID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(table));
        }
Esempio n. 10
0
        public async Task<IActionResult> Edit(int id, [Bind("Id,PerformanceId,Name,Email,NumberFullPrice,NumberConcessionPrice,StoreEmail,TotalCost")] Booking booking)
        {
            if (id != booking.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookingExists(booking.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(booking);
        }
Esempio n. 11
0
        public IActionResult ReturnedBook(int id)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(RedirectToAction("Index", "Library"));
                }

                using var db = new BookingContext();

                var reservedBook = db.ReservedBook.FirstOrDefault(x => x.ReservedBookId == id);

                reservedBook.ReturnedDate = DateTime.Now;

                db.Update(reservedBook);

                db.SaveChanges();

                return(RedirectToAction("Index", "Library", new { msg = "returned" }));
            }
            catch
            {
                return(RedirectToAction("Index", "Library", new { error = "error" }));
            }
        }
Esempio n. 12
0
        public async Task <IActionResult> Edit(long id, [Bind("Idcliente,Nome,Sobrenome,Email,Contacto,Morada,Localidade,CodPostal,Cc,DataNasc")] Clientes clientes)
        {
            if (id != clientes.Idcliente)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clientes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientesExists(clientes.Idcliente))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientes));
        }
Esempio n. 13
0
        public async Task <IActionResult> Edit(byte id, [Bind("Idregime,IdtipoQuarto,Data,Preco")] Precario precario)
        {
            if (id != precario.Idregime)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(precario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PrecarioExists(precario.Idregime))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idregime"]     = new SelectList(_context.Regimes, "Idregime", "TipoRegime", precario.Idregime);
            ViewData["IdtipoQuarto"] = new SelectList(_context.TipoQuarto, "IdtipoQuarto", "Descricao", precario.IdtipoQuarto);
            return(View(precario));
        }
Esempio n. 14
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,Price,Owner,Photo,PhotoPath")] Appartment appartment)
        {
            if (id != appartment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appartment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppartmentExists(appartment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(appartment));
        }
Esempio n. 15
0
        public async Task <IActionResult> Edit(byte id, [Bind("Idregime,Idhotel,TipoRegime")] Regimes regimes)
        {
            if (id != regimes.Idregime)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(regimes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegimesExists(regimes.Idregime))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idhotel"] = new SelectList(_context.Hoteis, "Idhotel", "CodPostal", regimes.Idhotel);
            return(View(regimes));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Department,BookingCount")] StaffNames staffNames)
        {
            if (id != staffNames.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffNames);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffNamesExists(staffNames.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffNames));
        }
Esempio n. 17
0
        public async Task <IActionResult> Edit(long id, [Bind("Idhotel,NomeHotel,NumEstrelas,Morada,Localidade,CodPostal,Pais,QuantidadeQuartos,Descricao")] Hoteis hoteis)
        {
            if (id != hoteis.Idhotel)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hoteis);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HoteisExists(hoteis.Idhotel))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hoteis));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Idreserva,Idhotel,Idcliente,Idregime,IdtipoQuarto,CodPagamento,QuantAdultos,QuantCriancas,CheckIn,CheckOut")] Reservas reservas)
        {
            if (id != reservas.Idreserva)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reservas);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReservasExists(reservas.Idreserva))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CodPagamento"] = new SelectList(_context.Pagamento, "CodPagamento", "DataValidadeCartao", reservas.CodPagamento);
            ViewData["Idcliente"]    = new SelectList(_context.Clientes, "Idcliente", "Cc", reservas.Idcliente);
            ViewData["Idhotel"]      = new SelectList(_context.Hoteis, "Idhotel", "CodPostal", reservas.Idhotel);
            ViewData["Idregime"]     = new SelectList(_context.Regimes, "Idregime", "TipoRegime", reservas.Idregime);
            ViewData["IdtipoQuarto"] = new SelectList(_context.TipoQuarto, "IdtipoQuarto", "Descricao", reservas.IdtipoQuarto);
            return(View(reservas));
        }
Esempio n. 19
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,BookingId,SeatNumber")] Seat seat)
        {
            if (id != seat.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(seat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SeatExists(seat.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(seat));
        }
Esempio n. 20
0
        public async Task <IActionResult> Edit(long id, [Bind("CodPagamento,IdtipoPagamento,NomeTitular,NumCartao,DataValidadeCartao,Cvv,Descricao")] Pagamento pagamento)
        {
            if (id != pagamento.CodPagamento)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pagamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PagamentoExists(pagamento.CodPagamento))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdtipoPagamento"] = new SelectList(_context.TipoPagamento, "IdtipoPagamento", "Designacao", pagamento.IdtipoPagamento);
            return(View(pagamento));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,EventColor,IsBookable,MaxOccupancy")] Rooms rooms)
        {
            if (id != rooms.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rooms);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    //if (!RoomsExists(rooms.ID))
                    //{
                    //    return NotFound();
                    //}
                    //else
                    //{
                    //    throw;
                    //}
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rooms));
        }
        public async Task <IActionResult> Edit(short id, [Bind("IdtipoPagamento,Designacao")] TipoPagamento tipoPagamento)
        {
            if (id != tipoPagamento.IdtipoPagamento)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tipoPagamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TipoPagamentoExists(tipoPagamento.IdtipoPagamento))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipoPagamento));
        }
        public async Task <IActionResult> Edit(long id, [Bind("IdtipoQuarto,Idhotel,Capacidade,Inventario,Descricao,Imagem")] TipoQuarto tipoQuarto)
        {
            if (id != tipoQuarto.IdtipoQuarto)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tipoQuarto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TipoQuartoExists(tipoQuarto.IdtipoQuarto))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idhotel"] = new SelectList(_context.Hoteis, "Idhotel", "CodPostal", tipoQuarto.Idhotel);
            return(View(tipoQuarto));
        }
Esempio n. 24
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,EndDate,FullPrice,ConcessionPrice")] Shows shows)
        {
            if (id != shows.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shows);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShowsExists(shows.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shows));
        }
Esempio n. 25
0
        public IActionResult Index(string port, string max, string email, string host, string password)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(RedirectToAction("Index", "Library"));
                }

                if (!string.IsNullOrEmpty(email) && (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(port)))
                {
                    return(RedirectToAction("Index", "Settings", new { error = "wrongEmailSettings" }));
                }

                using var db = new BookingContext();

                var settings = db.Settings.FirstOrDefault();

                if (string.IsNullOrEmpty(settings.Email) && !string.IsNullOrEmpty(email))
                {
                    return(RedirectToAction("Index", "Settings", new { error = "emptyPassword" }));
                }

                int?intPort = int.TryParse(port, out var tempVal) ? tempVal : (int?)null;
                settings.Port     = intPort;
                settings.Email    = email;
                settings.MaxTime  = int.Parse(max);
                settings.MailHost = host;

                if (!string.IsNullOrEmpty(password))
                {
                    settings.PasswordHost = DB.EncryptionMails.EncryptString(PASS_KEY, password);
                }
                db.Update(settings);
                db.SaveChanges();

                return(RedirectToAction("Index", "Settings", new { msg = "updated" }));
            }
            catch
            {
                return(RedirectToAction("Index", "Settings", new { error = "error" }));
            }
        }
Esempio n. 26
0
        public IActionResult Update(int id, string username, string email, string password, string SelectedRole)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(RedirectToAction("Index", "Library"));
                }

                using var db = new BookingContext();

                var user = db.Users.FirstOrDefault(x => x.UserId == id);

                if (user.Email != email && db.Users.Count(x => x.Email == email) > 0)
                {
                    return(RedirectToAction("Update", "User", new { error = "sameEmail" }));
                }

                //var passUpdated = false;
                if (!string.IsNullOrEmpty(password))
                {
                    user.Password = Encryption.Encrypt(password);
                    //passUpdated = true;
                }
                user.Username = username;
                user.Email    = email;
                user.Role     = int.Parse(SelectedRole);
                db.Update(user);
                db.SaveChanges();

                /*if (passUpdated)
                 * {
                 *  MailLibrary.MailNotifications.SendEmail(user.Email, $"Your password was updated. New password is: ${password}. If it was not requested, please contact the administration by phone.", "Password updated");
                 * }*/

                return(RedirectToAction("Update", "User", new { msg = "updated" }));
            }
            catch
            {
                return(RedirectToAction("Update", "User", new { error = "error" }));
            }
        }
Esempio n. 27
0
        public IActionResult CollectBook(int id, string barcode)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(RedirectToAction("Index", "Library"));
                }

                using var db = new BookingContext();

                var currentBC = db.BooksCopies.FirstOrDefault(x => x.BookId == id && x.Barcode == barcode && x.CanBeReserved == 1);

                if (currentBC == null)
                {
                    return(RedirectToAction("Index", "Library", new { error = "wrongBarcode" }));
                }

                if (db.ReservedBook.Count(x => x.BooksCopiesId == currentBC.BooksCopiesId && x.ReturnedDate == null) > 0)
                {
                    return(RedirectToAction("Index", "Library", new { error = "reservedBook" }));
                }

                var reservedBook = db.ReservedBook.FirstOrDefault(x => x.ReservedBookId == id);

                reservedBook.BooksCopiesId = currentBC.BooksCopiesId;

                reservedBook.CollectedDate = DateTime.Now;

                reservedBook.ReturnDate = DateTime.Now.AddDays(RETURN_DAYS);

                db.Update(reservedBook);

                db.SaveChanges();

                return(RedirectToAction("Index", "Library", new { msg = "collected" }));
            }
            catch
            {
                return(RedirectToAction("Index", "Library", new { error = "error" }));
            }
        }
        public IActionResult Index(string oldPassword, string newPassword, string rPassword)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(RedirectToAction("Index", "ChangePassword"));
                }

                if (newPassword != rPassword)
                {
                    return(RedirectToAction("Index", "ChangePassword", new { error = "wrongPasswords" }));
                }

                using var db = new BookingContext();

                var username = _httpContextAccessor.HttpContext.Session.GetString("user");

                var user = db.Users.FirstOrDefault(x => x.Username == username);

                if (Encryption.Encrypt(oldPassword).Equals(user.Password))
                {
                    user.Password = Encryption.Encrypt(newPassword);
                    db.Update(user);
                    db.SaveChanges();

                    //MailLibrary.MailNotifications.SendEmail(user.Email, "Your password was updated.", "Password updated");
                    return(RedirectToAction("Index", "ChangePassword", new { msg = "updated" }));
                }
                else
                {
                    return(RedirectToAction("Index", "ChangePassword", new { error = "wrongOld" }));
                }
            }
            catch
            {
                return(RedirectToAction("Index", "ChangePassword", new { error = "error" }));
            }
        }
Esempio n. 29
0
        public IActionResult Index(string email)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    if (_httpContextAccessor.HttpContext.Session.GetInt32("role") == 0)
                    {
                        return(RedirectToAction("Index", "Library"));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Booking"));
                    }
                }

                var db = new BookingContext();

                var isEmailInvalid = db.Users.Count(x => x.Email == email) > 0;

                var user = db.Users.FirstOrDefault(x => x.Username == _httpContextAccessor.HttpContext.Session.GetString("user"));

                if (isEmailInvalid && !user.Email.Equals(email))
                {
                    return(RedirectToAction("Index", "Profile", new { error = "registered" }));
                }

                user.Email = email;
                db.Update(user);
                db.SaveChanges();

                return(RedirectToAction("Index", "Profile", new { msg = "updated" }));
            }
            catch
            {
                return(RedirectToAction("Index", "Profile", new { error = "error" }));
            }
        }
Esempio n. 30
0
 public void UpdateOwner(Owner owner)
 {
     _dbContext.Update(owner);
 }