public async Task <IActionResult> Edit(int id, [Bind("Id,AddressTitle,AddressDetails,UserId")] Address address)
        {
            if (id != address.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(address);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AddressExists(address.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(Redirect("/Cart/PaymentDetail"));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", address.UserId);
            return(View(address));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("BrandId,Name")] Brand brand)
        {
            if (id != brand.BrandId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(brand);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrandExists(brand.BrandId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(brand));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("BookId,GenreId")] GenreBook genreBook)
        {
            if (id != genreBook.BookId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(genreBook);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GenreBookExists(genreBook.BookId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"]  = new SelectList(_context.Books, "BookId", "Name", genreBook.BookId);
            ViewData["GenreId"] = new SelectList(_context.Genres, "GenreId", "Name", genreBook.GenreId);
            return(View(genreBook));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,LastName,Email,UserName,Password,PhoneNumber,RoleId,GenderId")] 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(Edit)));
            }
            ViewData["GenderId"] = new SelectList(_context.Set <Gender>(), "Id", "Name", user.GenderId);
            ViewData["RoleId"]   = new SelectList(_context.Set <Role>(), "Id", "Name", user.RoleId);
            return(View(user));
        }
 public void Update(int id, Author newAuthor)
 {
     //var author = db.Authors.SingleOrDefault(b => b.Id == id);
     //author.FullName = newAuthor.FullName;
     db.Update(newAuthor);
     db.SaveChanges();
 }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,CartNo,Month,Year,CVV,UserId")] CreditCart creditCart)
        {
            if (id != creditCart.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(creditCart);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CreditCartExists(creditCart.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(Redirect("/Carts/PaymentDetail"));;
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", creditCart.UserId);
            return(View(creditCart));
        }
Exemple #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Image")] Author author)
        {
            if (id != author.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(author);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AuthorExists(author.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(author));
        }
Exemple #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CommentOfBook,BookId")] Comment comment)
        {
            if (id != comment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommentExists(comment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"] = new SelectList(_context.Books, "Id", "Name", comment.BookId);
            return(View(comment));
        }
Exemple #9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,BookName,Price,Publisher,Author")] Book book)
        {
            if (id != book.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(book);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookExists(book.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Image,Price,Content,PageNumber,Point,Rating,ReleaseDate,DiscountRate,SoldNumber,CategoryId,PublisherId,AuthorId")] Book book)
        {
            if (id != book.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(book);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookExists(book.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            List <SelectListItem> selectListItems           = GetCategoriesForSelect();
            List <SelectListItem> selectListItemsAuthors    = GetAuthorsForSelect();
            List <SelectListItem> selectListItemsPublishers = GetPublishersForSelect();

            ViewBag.Items           = selectListItems;
            ViewBag.ItemsAuthors    = selectListItemsAuthors;
            ViewBag.ItemsPublishers = selectListItemsPublishers;

            ViewData["AuthorId"]    = new SelectList(_context.Author, "Id", "Id", book.AuthorId);
            ViewData["CategoryId"]  = new SelectList(_context.Categories, "Id", "Id", book.CategoryId);
            ViewData["PublisherId"] = new SelectList(_context.Publisher, "Id", "Id", book.PublisherId);
            return(View(book));
        }
Exemple #11
0
 public void Update(int _id, Book element)
 {
     db.Update(element);
     db.SaveChanges();
 }
 public void Update(int id, Author newAuthor)
 {
     db.Update(newAuthor);
     db.SaveChanges();
 }
 public void Update(int Id, Author entity)
 {
     Log.Information("Update existing author");
     _dbContext.Update(entity);
     _dbContext.SaveChanges();
 }
Exemple #14
0
 public void Update(int Id, Book entity)
 {
     Log.Information("Update existing book");
     _dbContext.Update(entity);
     _dbContext.SaveChanges();
 }
 public void Update(int id, Author NewAuthor)
 {
     db.Update(NewAuthor);
     SaveChanges();
 }
 public void Update(int id, Book newBook)
 {
     db.Update(newBook);
     db.SaveChanges();
 }
Exemple #17
0
 public void Update(int id, Author entity)
 {
     db.Update(entity);
     db.SaveChanges();
 }
Exemple #18
0
 public void update(int id, Book newbook)
 {
     Db.Update(newbook);
     Db.SaveChanges();
 }
Exemple #19
0
 public void Update(Book book)
 {
     context.Update(book);
     context.SaveChanges();
 }
 public void Update(int _id, Auther element)
 {
     db.Update(element);
     db.SaveChanges();
 }