public void T2_Equal_ReturnsTrueIfCopyIsSame() { Copy firstCopy = new Copy(1); Copy secondCopy = new Copy(1); Assert.Equal(firstCopy, secondCopy); }
public void Test_Equal_EntriesMatch() { Copy testCopy1 = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); Copy testCopy2 = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); Assert.Equal(testCopy1, testCopy2); }
// public static Copy Find(int id) { SqlConnection conn = DB.Connection(); conn.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM copies WHERE id = @CopyId;", conn); SqlParameter copyIdParameter = new SqlParameter(); copyIdParameter.ParameterName = "@CopyId"; copyIdParameter.Value = id.ToString(); cmd.Parameters.Add(copyIdParameter); SqlDataReader rdr = cmd.ExecuteReader(); int foundCopyId = 0; int foundCopyBookId = 0; while (rdr.Read()) { foundCopyId = rdr.GetInt32(0); foundCopyBookId = rdr.GetInt32(1); } Copy foundCopy = new Copy(foundCopyBookId, foundCopyId); if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); } return foundCopy; }
public void Test_FindCopy() { Copy newcopy = new Copy(0, new DateTime(2016,07,20), 1); newcopy.Save(); Assert.Equal(newcopy.id, Copy.Find(newcopy.id).id); }
public void Test_Find_FindCopyInDatabase() { Copy testCopy = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); testCopy.Save(); Copy result = Copy.Find(testCopy.GetId()); Assert.Equal(testCopy, result); }
public void T5_Find_FindsCopyInDatabase() { Copy testCopy = new Copy(1); testCopy.Save(); Copy foundCopy = Copy.Find(testCopy.GetId()); Assert.Equal(testCopy, foundCopy); }
public void T3_Save_SavesToDB() { Copy testCopy = new Copy(1); testCopy.Save(); List<Copy> result = Copy.GetAll(); List<Copy> testList = new List<Copy>{testCopy}; Assert.Equal(testList, result); }
public void T4_Save_AssignsIdToCopy() { Copy testCopy = new Copy(2); testCopy.Save(); Copy savedCopy = Copy.GetAll()[0]; int result = savedCopy.GetId(); int testId = testCopy.GetId(); Assert.Equal(testId, result); }
public void Test_GetAll_RetrieveAllCopies() { Copy testCopy1 = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); Copy testCopy2 = new Copy ("Worn & Torn", 2, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); testCopy1.Save(); testCopy2.Save(); List<Copy> testList = new List<Copy> {testCopy1, testCopy2}; List<Copy> result = Copy.GetAll(); Assert.Equal(testList, result); }
public void Test_Checkout() { Copy newcopy = new Copy(0, new DateTime(2016,07,20), 1); newcopy.Save(); Patron p = new Patron(0, "Pat", ""); p.Save(); p.Checkout(newcopy.id); Assert.Equal(p.id, Copy.Find(newcopy.id).patron_id); }
public void Test_AddCopy_AddAnCopyToAPatron() { Patron testPatron = new Patron ("Jane", "Doe", "555-555-5555"); testPatron.Save(); Copy newCopy = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); newCopy.Save(); testPatron.AddCopy(newCopy); List<Copy> testCopy = new List<Copy> {newCopy}; List<Copy> allCopies = testPatron.GetCopies(); Assert.Equal(testCopy, allCopies); }
public void Test_Checkin() { Copy newcopy = new Copy(0, new DateTime(2016,06,27), 1); newcopy.Save(); Patron p = new Patron(0, "Pat", ""); p.Save(); p.Checkout(newcopy.id); newcopy.Update(new List<string> {"due_date"}, new List<object> {new DateTime(2016,07,19)}); Copy.Find(newcopy.id).Checkin(); Assert.Equal(10, Patron.Find(p.id).balance); }
public void Test_DeleteOne_DeletesOneCopy() { Copy newCopy1 = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); Copy newCopy2 = new Copy ("Worn & Torn", 2, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); newCopy1.Save(); newCopy2.Save(); List<Copy> newList = Copy.GetAll(); newCopy1.DeleteOne(); List<Copy> resultList = Copy.GetAll(); List<Copy> testList = new List<Copy> {newCopy2}; Assert.Equal(testList, resultList); }
public void T1_Checkout_CreatesACheckoutRecord() { Patron testPatron = new Patron("Judy"); testPatron.Save(); Copy testCopy = new Copy(5); testCopy.Save(); DateTime checkoutDate = new DateTime(2016,08,04); DateTime dueDate = new DateTime(2017,01,02); Checkout newCheckout = new Checkout(testCopy.GetId(), testPatron.GetId(), checkoutDate, dueDate); newCheckout.Save(); List<Checkout> result = Checkout.GetAll(); Assert.Equal(newCheckout, result[0]); }
public static Copy Find(int searchId) { Copy foundCopy = new Copy("", 0); //Program needs some value inside a Copy object SqlConnection conn = DB.Connection(); conn.Open(); SqlDataReader rdr = null; SqlCommand cmd = new SqlCommand ("SELECT * FROM copies WHERE id = @CopyId;", conn); SqlParameter idParameter = new SqlParameter(); idParameter.ParameterName = "@CopyId"; idParameter.Value = searchId; cmd.Parameters.Add(idParameter); rdr = cmd.ExecuteReader(); while (rdr.Read()) { int copyId = rdr.GetInt32(0); DateTime copyCheckoutDate = rdr.GetDateTime(1); string copyCondition = rdr.GetString(2); int bookId = rdr.GetInt32(3); DateTime copyDueDate = rdr.GetDateTime(4); Copy newCopy = new Copy (copyCondition, bookId, copyCheckoutDate, copyDueDate, copyId); foundCopy = newCopy; } if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); } return foundCopy; }
public void Test_GetHistory() { Copy newcopy = new Copy(0, new DateTime(2016,07,20), 1); newcopy.Save(); Patron p = new Patron(0, "Pat", ""); p.Save(); p.Checkout(newcopy.id); Assert.Equal(1, p.GetHistory().Count); }
public ReturnEvent(Copy copy, DateTimeOffset eventDate, Reader reader, BorrowingEvent borrowing) : base(copy, eventDate) { this.Reader = reader; this.Borrowing = borrowing; }
public void Test_GetCopies() { Book newbook = new Book("2a", "Sf", "The blob"); newbook.Save(); Copy newcopy = new Copy(newbook.id, new DateTime(2016,07,20), 1); newcopy.Save(); Assert.Equal(newcopy.id, newbook.GetCopies()[0].id); }
public BorrowingEvent(Reader reader, Copy copy, DateTimeOffset eventDate, DateTimeOffset returnDate) : base(copy, eventDate) { this.ReturnDate = returnDate; this.Reader = reader; this.Completed = false; }
public static List<Copy> GetAll() { List<Copy> allcopies = new List<Copy>{}; SqlConnection conn = DB.Connection(); conn.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM copies;", conn); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { int copyId = rdr.GetInt32(0); int copyBookId = rdr.GetInt32(1); Copy newCopy = new Copy(copyBookId, copyId); allcopies.Add(newCopy); } if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); } return allcopies; }
public static List<Copy> GetAll() { List<Copy> allCopies = new List<Copy> {}; SqlConnection conn = DB.Connection(); conn.Open(); SqlDataReader rdr = null; SqlCommand cmd = new SqlCommand ("SELECT * FROM copies;", conn); rdr = cmd.ExecuteReader(); while (rdr.Read()) { int copyId = rdr.GetInt32(0); DateTime copyCheckoutDate = rdr.GetDateTime(1); string copyCondition = rdr.GetString(2); int bookId = rdr.GetInt32(3); DateTime copyDueDate = rdr.GetDateTime(4); Copy newCopy = new Copy (copyCondition, bookId, copyCheckoutDate, copyDueDate, copyId); allCopies.Add(newCopy); } if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); } return allCopies; }
public void Test_overDueBooks() { Patron p = new Patron(0, "Pat", ""); p.Save(); Copy newcopy = new Copy(0, new DateTime(2016,06,27), 1); newcopy.Save(); p.Checkout(newcopy.id); newcopy.Update(new List<string> {"due_date"}, new List<object> {new DateTime(2016,07,19)}); List<Copy> isoverdue = Copy.OverdueBooks(); Assert.Equal(1, isoverdue.Count); }
public void T6_Update_UpdatesCopyInDB() { Copy testCopy = new Copy(1); testCopy.Save(); int newBookId = 2; testCopy.Update(newBookId); int resultBookId = testCopy.GetBookId(); Assert.Equal(newBookId, resultBookId); }
public void T7_Delete_DeletesCopyFromDB() { //Always remember to save to DB (Save()) Copy testCopy1 = new Copy(1); testCopy1.Save(); Copy testCopy2 = new Copy(2); testCopy2.Save(); testCopy1.Delete(); List<Copy> result = Copy.GetAll(); List<Copy> testCopies = new List<Copy> {testCopy2}; Assert.Equal(testCopies, result); }
public void Test_Update_UpdateCopyInDatabase() { Copy newCopy = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); newCopy.Save(); newCopy.SetCondition("Worn & Torn"); newCopy.Update(); Copy updatedCopy = Copy.Find(newCopy.GetId()); Assert.Equal(newCopy.GetCondition(), updatedCopy.GetCondition()); }
public HomeModule() { Get["/"] = _ => { return(View["patron_login.cshtml"]); }; Post["/home"] = _ => { //make newPatron object with more information like password and username Patron newPatron = new Patron(Request.Form["new-name"]); newPatron.Save(); return(View["patron_home.cshtml", newPatron]); }; Get["/search/books"] = _ => { return(View["search_books.cshtml"]); }; Post["/search/books"] = _ => { Book foundBook = Book.Search(Request.Form["title"]); return(View["search_books.cshtml", foundBook]); }; Get["/checkout/{id}"] = parameters => { Book foundBook = Book.Find(parameters.id); return(View["checkout.cshtml", foundBook]); }; //////////////////////////////////////////////////////////////// Get["/admin/login"] = _ => { return(View["admin_login.cshtml"]); }; Post["/admin/home"] = _ => { //make newPatron object with more information like password and username Patron newPatron = new Patron(Request.Form["admin-new-name"]); newPatron.Save(); return(View["admin_home.cshtml", newPatron]); }; Get["/admin/books"] = _ => { return(View["admin_books.cshtml", ModelMaker()]); }; Post["/admin/books"] = _ => { Author newAuthor = new Author(Request.Form["author"]); newAuthor.Save(); Book newBook = new Book(Request.Form["title"]); newBook.Save(); newBook.AddAuthor(newAuthor.GetId()); for (int i = 1; i <= Request.Form["copy"]; i++) { Copy newCopy = new Copy(newBook.GetId(), i); newCopy.Save(); } return(View["admin_books.cshtml", ModelMaker()]); }; Get["/admin/books/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object> { }; Book newBook = Book.Find(parameters.id); model.Add("Book", newBook); List <Author> newBookAuthor = newBook.GetAuthor(); model.Add("Authors", newBookAuthor); List <Copy> newBookCopies = newBook.GetCopy(); model.Add("Copies", newBookCopies); return(View["book.cshtml", model]); }; // that works -V Delete["/admin/book/{id}"] = parameters => { Book selectedBook = Book.Find(parameters.id); selectedBook.Delete(); return(View["admin_books.cshtml", ModelMaker()]); }; Patch["/admin/book/{id}"] = parameters => { Book selectedBook = Book.Find(parameters.id); selectedBook.UpdateTitle(Request.Form["name"]); return(View["admin_books.cshtml", ModelMaker()]); }; // Post["/admin/home"] = _ => // { // model = // return view["admin_home.cshtml", ModelMaker()]; // }; }
public void Test_Save_SavesCopiesToDatabase() { Copy newCopy1 = new Copy ("New", 1, new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); Copy newCopy2 = new Copy ("Worn & Torn", 2, new DateTime(2016, 7, 25), new DateTime (2016, 8, 25)); newCopy1.Save(); newCopy2.Save(); int resultCount = Copy.GetAll().Count; Assert.Equal(2, resultCount); }
public void Test_GetCopies_ReturnsAllCopiesForBook() { Book testBook = new Book ("Redwall"); testBook.Save(); Copy newCopy1 = new Copy ("New", testBook.GetId(), new DateTime(2016, 7, 25), new DateTime(2016, 8, 25)); Copy newCopy2 = new Copy ("Worn & Torn", testBook.GetId(), new DateTime(2016, 7, 25), new DateTime (2016, 8, 25)); newCopy1.Save(); newCopy2.Save(); List<Copy> testCopyList = new List<Copy> {newCopy1, newCopy2}; List<Copy> resultCopyList = testBook.GetCopies(); Assert.Equal(testCopyList, resultCopyList); }
public DestructionEvent(Copy copy, DateTimeOffset eventDate, string reason) : base(copy, eventDate) { this.Reason = reason; }
public List<Copy> GetCopies() { List<Copy> allCopies = new List<Copy> {}; SqlConnection conn = DB.Connection(); conn.Open(); SqlDataReader rdr = null; SqlCommand cmd = new SqlCommand ("SELECT * FROM copies WHERE book_id = @BookId;", conn); SqlParameter bookIdParameter = new SqlParameter (); bookIdParameter.ParameterName = "@BookId"; bookIdParameter.Value = this.GetId(); cmd.Parameters.Add(bookIdParameter); rdr = cmd.ExecuteReader(); while (rdr.Read()) { int copyId = rdr.GetInt32(0); DateTime copyCheckoutDate = rdr.GetDateTime(1); string copyCondition = rdr.GetString(2); int copyBookId = rdr.GetInt32(3); DateTime copyDueDate = rdr.GetDateTime(4); Copy newCopy = new Copy (copyCondition, copyBookId, copyCheckoutDate, copyDueDate, copyId); allCopies.Add(newCopy); } if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close(); } return allCopies; }
public void Test_GetItemsOut() { Patron p = new Patron(0, "Pat", ""); p.Save(); Copy newcopy = new Copy(0, new DateTime(2016,07,20), p.id); newcopy.Save(); Assert.Equal(newcopy.id, p.GetItemsOut()[0].id); }
public void T8_Addpatron_AddspatronToCopy() { Book newBook = new Book("Freedom"); newBook.Save(); Patron testPatron = new Patron("Sarah"); testPatron.Save(); Copy testCopy = new Copy(1); testCopy.Save(); testCopy.AddPatron(testPatron); List<Patron> result = testCopy.GetPatron(); List<Patron> testList = new List<Patron> {testPatron}; Assert.Equal(testList, result); }
public HomeModule() { Get["/"] =_=>{ return View["index.cshtml"]; }; Get["/references"] =_=>{ List<Book> search = new List<Book> {}; return View["references.cshtml",search]; }; Get["/patrons"]=_=>{ List<Book> search = new List<Book> {}; return View["patrons.cshtml",search]; }; Get["/books/{id}"] =parameters=> { Book b = Book.Find(parameters.id); return View["book.cshtml", b]; }; Get["/patronview/books/{id}"] =parameters=> { Book b = Book.Find(parameters.id); return View["patronview-book.cshtml", b]; }; Get["/copies/{id}"] =parameters=> { Copy c = Copy.Find(parameters.id); return View["copy.cshtml", c]; }; Get["/patronview/copies/{id}"] =parameters=> { Copy c = Copy.Find(parameters.id); return View["patronview-copy.cshtml", c]; }; Delete["/copies/delete/{id}"] =parameters=> { Copy c = Copy.Find(parameters.id); c.Delete(new string[] {"checkouts"}, new string[] {"copy_id"}); return View["book.cshtml", Book.Find(c.book_id)]; }; Patch["/books/edit/{id}"] =parameters=> { Book b = Book.Find(parameters.id); b.Update(new List<string> {"call_number", "collection", "title"}, new List<object> {(string)Request.Form["callNumber"], (string)Request.Form["collection"], (string)Request.Form["title"]}); b.RemoveAuthors(); for(int i = 0; i<Request.Form["number-of-authors"]; i++) { Author a = Author.FindByName(Request.Form["author" + i]); if(a==null) { a = new Author(Request.Form["author" + i]); a.Save(); } b.AddAuthor(a.id); } return View["book.cshtml", b]; }; Get["/circulation"] =_=>{ return View["circulation.cshtml"]; }; Post["/patron/new"] =_=> { Patron p = new Patron(0, (string)Request.Form["name"], ""); p.Save(); return View["patron.cshtml", p]; }; Post["/check-out/{id}"] =parameters=> { Patron p = Patron.Find(parameters.id); Copy c = Copy.Find((int)Request.Form["itemId"]); if(c!=null) { p.Checkout(c.id); } return View["patron.cshtml", p]; }; Get["/check-in"] =_=> { return View["check-in.cshtml"]; }; Post["/check-in/new"] =_=> { int copyId = (int)Request.Form["id"]; Copy c = Copy.Find(copyId); if(c!=null) { c.Checkin(); } return View["check-in.cshtml"]; }; Get["/check-out"] =_=> { return View["check-out.cshtml", ""]; }; Post["/patron"] =_=> { Patron p = Patron.Find((int)Request.Form["patronId"]); if(p==null) { return View["check-out.cshtml", "No Patron Found"]; } else { return View["patron.cshtml", p]; } }; Post["/patronview"] =_=> { Patron p = Patron.Find((int)Request.Form["patronId"]); if(p==null) { return View["check-out.cshtml", "No Patron Found"]; } else { return View["patronview.cshtml", p]; } }; Get["/catalog"] =_=>{ return View["catalog.cshtml"]; }; Post["books/new"] =_=> { Book newBook = new Book(Request.Form["callNumber"], Request.Form["collection"], Request.Form["title"]); newBook.Save(); Copy newCopy = new Copy(newBook.id, new DateTime(1900,1,1), 0); newCopy.Save(); for(int i = 0; i<Request.Form["number-of-authors"]; i++) { Author a = Author.FindByName(Request.Form["author" + i]); if(a==null) { a = new Author(Request.Form["author" + i]); a.Save(); } newBook.AddAuthor(a.id); } return View["book.cshtml", newBook]; }; Post["copies/new"] =_=> { int bookId = (int)Request.Form["book_id"]; Copy newCopy = new Copy(bookId, new DateTime(1900,1,1), 0); newCopy.Save(); return View["copy.cshtml", newCopy]; }; Post["/search"] =_=> { string search = Request.Form["search"]; string searchType = Request.Form["searchdef"]; List<Book> booksearch = Book.Search(search,searchType); return View["references.cshtml",booksearch]; }; Post["/patronview/search"] =_=> { string search = Request.Form["search"]; string searchType = Request.Form["searchdef"]; List<Book> booksearch = Book.Search(search,searchType); return View["patrons.cshtml",booksearch]; }; Get["/patron/edit/{id}"]=parameters=>{ Patron findpatron = Patron.Find(parameters.id); return View["updatepatron.cshtml", findpatron]; }; Patch["/patron/edit/{id}"]=parameters=>{ Patron findpatron = Patron.Find(parameters.id); findpatron.Update(new List<string>{"name", "notes"}, new List<object>{(string)Request.Form["patronname"], (string)Request.Form["notes"]}); return View["patron.cshtml", findpatron]; }; Patch["/patron/payfines/{id}"]=parameters=> { Patron p = Patron.Find(parameters.id); p.PayFines(Request.Form["amount"]); return View["patron.cshtml", p]; }; Get["/overdue"]=_=> { List<Copy> overDueBooks = Copy.OverdueBooks(); return View["overdue.cshtml",overDueBooks]; }; Get["/patron/{id}"] = parameters => { Patron p = Patron.Find(parameters.id); return View["patron.cshtml", p]; }; }
public void T9_GetPatrons_ReturnsAllCopyPatrons() { Patron testPatron1 = new Patron("Sarah"); testPatron1.Save(); Patron testPatron2 = new Patron("John"); testPatron2.Save(); Copy testCopy = new Copy(5); testCopy.Save(); testCopy.AddPatron(testPatron1); List<Patron> result = testCopy.GetPatron(); List<Patron> testList= new List<Patron>{testPatron1}; Assert.Equal(testList,result); }
public HomeModule() { Get["/"] = _ => { // List<Stylist> AllLists = Stylist.GetAll(); return(View["index.cshtml"]); }; Get["/books"] = _ => { var AllBooks = Book.GetAll(); return(View["books.cshtml", AllBooks]); }; Get["/patrons"] = _ => { List <Patron> allPatrons = Patron.GetAll(); return(View ["patrons.cshtml", allPatrons]); }; Get["/books/new"] = _ => { return(View["books_form.cshtml"]); }; Post["/books/new"] = _ => { Book newBook = new Book(Request.Form["title"]); newBook.Save(); Copy newCopy = new Copy(newBook.GetId(), Request.Form["number-of"], DateTime.Today); newCopy.Save(); Author newAuthor = new Author(Request.Form["author"]); newAuthor.Save(); newBook.AddAuthor(newAuthor); List <Author> allAuthors = Author.GetAll(); List <Copy> allCopies = Copy.GetAll(); List <Book> allBooks = Book.GetAll(); return(View["success.cshtml"]); }; Get["/books/search"] = _ => { return(View["books_search.cshtml"]); }; Get["/books/found"] = _ => { List <Author> selectAuthors = new List <Author> { }; List <Book> foundBooks = new List <Book> { }; string authorName = Request.Form["name"]; List <Author> allAuthors = Author.GetAll(); foreach (Author listAuthor in allAuthors) { if (listAuthor.GetName() == authorName) { selectAuthors.Add(listAuthor); } } foreach (Author newAuthor in selectAuthors) { foundBooks = newAuthor.GetBooks(); } return(View["/books_found.cshtml", foundBooks]); }; Get["/patrons/new"] = _ => { List <Patron> AllPatrons = Patron.GetAll(); return(View["patrons_form.cshtml", AllPatrons]); }; Post["/patrons/new"] = _ => { Patron newPatron = new Patron(Request.Form["name"]); newPatron.Save(); return(View["success.cshtml"]); }; Get["/books/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); var selectedBook = Book.Find(parameters.id); List <Author> author = selectedBook.GetAuthors(); selectedBook.AddAuthor(author[0]); var copies = selectedBook.GetCopies(); model.Add("book", selectedBook); model.Add("author", author); model.Add("copies", copies); return(View["book.cshtml", model]); }; Get["/patron/{id}"] = parameters => { Patron selectedPatron = Patron.Find(parameters.id); List <object> model = new List <object> { }; List <Book> bookList = Book.GetAll(); model.Add(selectedPatron); model.Add(bookList); return(View["patron.cshtml", model]); }; Get["patron/checkout/{id}"] = parameters => { List <Book> bookList = new List <Book> { }; Patron selectedPatron = Patron.Find(parameters.id); Book newBook = Book.Find(int.Parse(Request.Form("book"))); Console.WriteLine(newBook); bookList.Add(newBook); return(View["patron_checkout.cshtml", bookList]); }; // Patch["patron/checkout/{id}"] = parameters => { // Patron selectedPatron = Patron.Find(parameters.id); // Book newBook = Book.Find(Request.Form("book")); // return View["success.cshtml"]; // }; Get["/book/edit/{id}"] = parameters => { Book selectedBook = Book.Find(parameters.id); return(View["book_edit.cshtml", selectedBook]); }; Patch["/book/edit/{id}"] = parameters => { Book selectedBook = Book.Find(parameters.id); selectedBook.Update(Request.Form["book-title"]); return(View["success.cshtml"]); }; Get["/patron/edit/{id}"] = parameters => { Patron selectedPatron = Patron.Find(parameters.id); return(View["patron_edit.cshtml", selectedPatron]); }; Patch["/patron/edit/{id}"] = parameters => { Patron selectedPatron = Patron.Find(parameters.id); selectedPatron.Update(Request.Form["name"]); return(View["success.cshtml"]); }; Get["/book/delete/{id}"] = parameters => { Book selectedBook = Book.Find(parameters.id); return(View["/book_delete.cshtml", selectedBook]); }; Delete["book/delete/{id}"] = parameters => { Book selectedBook = Book.Find(parameters.id); selectedBook.Delete(); return(View["success.cshtml"]); }; Get["/patron/delete/{id}"] = parameters => { Patron selectedPatron = Patron.Find(parameters.id); return(View["/patron_delete.cshtml", selectedPatron]); }; Delete["/patron/delete/{id}"] = parameters => { Patron selectedPatron = Patron.Find(parameters.id); selectedPatron.Delete(); return(View["success.cshtml"]); }; }