Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("LeaseId,BookId,UserId,Date")] Lease lease)
        {
            if (id != lease.LeaseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lease);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LeaseExists(lease.LeaseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"] = new SelectList(_context.Book, "BookId", "BookId", lease.BookId);
            ViewData["UserId"] = new SelectList(_context.User, "UserId", "Login", lease.UserId);
            return(View(lease));
        }
        public async Task <IActionResult> Edit(int id, [Bind("id,title")] Chapter chapter)
        {
            if (id != chapter.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(chapter);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChapterExists(chapter.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(chapter));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CityId,ConferenceId,Year,Bibliography,SupervisorId,ConferenceStartDate,ConferenceEndDate,PublicationDate,Pages,Page,Volume,ConferenceNumber")] Article article)
        {
            if (id != article.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(article);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArticleExists(article.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"]       = new SelectList(_context.City, "Id", "Name", article.CityId);
            ViewData["ConferenceId"] = new SelectList(_context.Conference, "Id", "Name", article.ConferenceId);
            ViewData["SupervisorId"] = new SelectList(_context.Author, "Id", "LastName", article.SupervisorId);
            return(View(article));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("StudentId,Name,RollNo,NRC,Grade")] Student student)
        {
            if (id != student.StudentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.StudentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,Title,Content,CreationDate")] Draft draft)
        {
            if (id != draft.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(draft);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DraftExists(draft.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(draft));
        }
Esempio n. 6
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Name,Surname,AddressId,UserType,Login,Password")] User user)
        {
            if (id != user.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddressId"] = new SelectList(_context.Address, "AddressId", "AddressId", user.AddressId);
            return(View(user));
        }
Esempio n. 7
0
        public async Task <IActionResult> Edit(int id, [Bind("AddressId,City,Street,StreetNumber,PostalCode")] Address address)
        {
            if (id != address.AddressId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(address);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AddressExists(address.AddressId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
Esempio n. 8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,BookId,ApplicationUserId,StartDate,MaxDate,EndDate, Description")] Borrowing borrowing)
        {
            if (id != borrowing.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(borrowing);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BorrowingExists(borrowing.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUser, "Id", "UserName", borrowing.ApplicationUserId);
            ViewData["BookId"]            = new SelectList(_context.Book, "Id", "Title", borrowing.BookId);
            return(View(borrowing));
        }
Esempio n. 9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,BookId,StudentId,RentDate,Qty")] BookRent bookRent)
        {
            if (id != bookRent.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bookRent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookRentExists(bookRent.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"]    = new SelectList(_context.Book, "BookId", "BookId", bookRent.BookId);
            ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", bookRent.StudentId);
            return(View(bookRent));
        }
Esempio n. 10
0
        public async Task <IActionResult> Edit(int id, [Bind("ArticleId,KeywordId")] ArticleKeyword articleKeyword)
        {
            if (id != articleKeyword.ArticleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(articleKeyword);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArticleKeywordExists(articleKeyword.ArticleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArticleId"] = new SelectList(_context.Article, "Id", "Name", articleKeyword.ArticleId);
            ViewData["KeywordId"] = new SelectList(_context.Keyword, "Id", "Name", articleKeyword.KeywordId);
            return(View(articleKeyword));
        }
        public async Task <IActionResult> Edit(int id, [Bind("id,firstName,lastName,date,book_title")] Readers_Card readers_Card)
        {
            if (id != readers_Card.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(readers_Card);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Readers_CardExists(readers_Card.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(readers_Card));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ReturnId,Qty,ReturnDate,Id")] ReturnBook returnBook)
        {
            if (id != returnBook.ReturnId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(returnBook);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReturnBookExists(returnBook.ReturnId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Bookrent, "Id", "Id", returnBook.Id);
            return(View(returnBook));
        }
Esempio n. 13
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Goal,Tasks,Progress")] Research research)
        {
            if (id != research.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(research);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ResearchExists(research.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(research));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DisciplineId,AuthorId")] DisciplineAuthor disciplineAuthor)
        {
            if (id != disciplineAuthor.DisciplineId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(disciplineAuthor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DisciplineAuthorExists(disciplineAuthor.DisciplineId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AuthorId"]     = new SelectList(_context.Author, "Id", "LastName", disciplineAuthor.AuthorId);
            ViewData["DisciplineId"] = new SelectList(_context.Discipline, "Id", "Name", disciplineAuthor.DisciplineId);
            return(View(disciplineAuthor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CategoryId,CategoryName,Description")] Category category)
        {
            if (id != category.CategoryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.CategoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Esempio n. 16
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Author,ISBN,PublicationYear,Publisher,Country")] 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));
        }
Esempio n. 17
0
        public async Task <IActionResult> Edit(int id, [Bind("LoanID,UserID,BookID")] Loan loan)
        {
            if (id != loan.LoanID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoanExists(loan.LoanID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookID"] = new SelectList(_context.Books, "ID", "ID", loan.BookID);
            ViewData["UserID"] = new SelectList(_context.Users, "ID", "ID", loan.UserID);
            return(View(loan));
        }
Esempio n. 18
0
        public async Task <IActionResult> Edit(int id, [Bind("Id, Title, Year, Cost, ImageUrl, NumberOfCopies, ISBN, Author, DeweyIndex, LocationId")] Asset libraryAsset)
        {
            if (id != libraryAsset.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(libraryAsset);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LibraryAssetExists(libraryAsset.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Asset"));
            }
            return(View(libraryAsset));
        }
Esempio n. 19
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Address,DateOfBirth,TelephoneNumber,HomeLibraryBranchId")] Patron patron)
        {
            if (id != patron.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(patron);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatronExists(patron.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Patron"));
            }
            return(View(patron));
        }
Esempio n. 20
0
        public async Task <IActionResult> Edit(int id, [Bind("ResearchId,ThemeId")] ResearchTheme researchTheme)
        {
            if (id != researchTheme.ResearchId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(researchTheme);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ResearchThemeExists(researchTheme.ResearchId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ResearchId"] = new SelectList(_context.Research, "Id", "Name", researchTheme.ResearchId);
            ViewData["ThemeId"]    = new SelectList(_context.Theme, "Id", "Name", researchTheme.ThemeId);
            return(View(researchTheme));
        }
Esempio n. 21
0
        public async Task <IActionResult> Edit(int id, [Bind("ThemeId,ArticleId")] ThemeArticle themeArticle)
        {
            if (id != themeArticle.ThemeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(themeArticle);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ThemeArticleExists(themeArticle.ThemeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArticleId"] = new SelectList(_context.Article, "Id", "Name", themeArticle.ArticleId);
            ViewData["ThemeId"]   = new SelectList(_context.Theme, "Id", "Name", themeArticle.ThemeId);
            return(View(themeArticle));
        }
Esempio n. 22
0
        public async Task <IActionResult> Edit(int id, [Bind("id,firstName,lastName,dateOfBirth,books_amount")] 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));
        }
Esempio n. 23
0
        public async Task <IActionResult> Edit(int id, [Bind("BookId,Title,AuthorId,Description,BookType")] Book book)
        {
            if (id != book.BookId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(book);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookExists(book.BookId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AuthorId"] = new SelectList(_context.Author, "AuthorId", "AuthorId", book.AuthorId);
            return(View(book));
        }
Esempio n. 24
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address,Telephone,Description,OpenDate,ImageUrl")] Branch libraryBranch)
        {
            if (id != libraryBranch.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(libraryBranch);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LibraryBranchExists(libraryBranch.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Branch"));
            }
            return(View(libraryBranch));
        }
Esempio n. 25
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstMidName")] 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));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AuthorId,BookId")] AuthorBook authorBook)
        {
            if (id != authorBook.AuthorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(authorBook);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AuthorBookExists(authorBook.AuthorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AuthorId"] = new SelectList(_context.Author, "Id", "LastName", authorBook.AuthorId);
            ViewData["BookId"]   = new SelectList(_context.Book, "Id", "Name", authorBook.BookId);
            return(View(authorBook));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ContentType,Data,TypeId,Version,ArticleId")] FileArticle fileArticle)
        {
            if (id != fileArticle.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(fileArticle);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FileArticleExists(fileArticle.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArticleId"] = new SelectList(_context.Article, "Id", "Name", fileArticle.ArticleId);
            ViewData["TypeId"]    = new SelectList(_context.FileType, "Id", "Name", fileArticle.TypeId);
            return(View(fileArticle));
        }
Esempio n. 28
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Content,Explanation")] Hypothesis hypothesis)
        {
            if (id != hypothesis.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hypothesis);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HypothesisExists(hypothesis.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hypothesis));
        }
Esempio n. 29
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Scale scale)
        {
            if (id != scale.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(scale);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ScaleExists(scale.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(scale));
        }
Esempio n. 30
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TestDate,NoOfParticipants")] TestDetails testDetails)
        {
            if (id != testDetails.ID)
            {
                return(NotFound());
            }

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