Placeholder Image

Subtitles section Play video

  • Hey guys, Wes here. So, I don't know about you guys, but I think the first place. I ever used the internet was at the library

  • so I just finished designing a

  • library management system in ASP.NET Core MVC

  • and I thought it would be kind of fun to

  • Make a series of videos documenting that project so you guys could follow along and we could do some full stack development

  • We're going to do everything from setting up and designing the database

  • to implementing the MVC pattern and then finally playing around with some front-end stuff like DataTables (.js)

  • and maybe some Material Design and Bootstrap

  • So yeah, the project was kind of fun, and I thought it might be something that you guys would be interested in checking out

  • So yeah, let's take a look

  • Okay, so let's take a look at the software we'll be building over the course of the next several videos

  • So we have here an integrated library system for a fictional library called Lake View

  • So an integrative library system also sometimes called a library management system is the software that a library uses to

  • to lend its Assets and manage its assets

  • As they're lent out to various patrons who might sign up for a library card

  • within that system. So - the library is going to control

  • You know it's books, magazines - things like that

  • so it's going to need to manage all of its inventory and

  • sort of control, you know, how it lends out to its various patrons and to keep track of what patrons have what assets and

  • what patrons have certain items on hold, for instance.

  • It's also going to want to track the different branches that belong to that library, so if you live,

  • for example, in a larger city or region, then your library system might consist of multiple branches

  • Let's take a look first of all at our library catalog

  • So you'll see here that we just have a list of assets very simply in a table here

  • And so we're going to have like the title of whatever the past that is in this case. We'll have a lot of books

  • The author or director, and then a do we call number, so if the library's going to do a decimal system

  • This is just a way that they index their books yeah, we can see that the books all have covers

  • And if they don't we have no cover available icon here

  • So if we click on one of the books we get taken to a detail page here

  • so we have a lot more Metadata on this book that we can see so we've got an iSbn for instance a

  • Call number again. This is the Dewey call number the cost of this asset

  • What it is so if it's a book or a video or anything?

  • Its last location so the answers will be associated with a particular Branch

  • Some checkout history, so in other words

  • what patrons have checked out this item in the past and over what period of time and

  • Then also a list of current holds so look at what that means in here in a second

  • So let's say I wanted to check this book out so I just click here

  • and then we supply a library card id to which we to check out the book and

  • now we can see that the book is no longer available, but it has been checked out by this patron and

  • We can see now that we have a new checkout history started in the table here as well

  • So the book hasn't been returned yet, but it was checked out this time on this date

  • So now let's say that I'd like to check the book out, but I'm another patron

  • and of course it's not available for checkout yet, but I can place a hold will click place hold here and

  • Let's say we'll put the new customers

  • library card Id here and we'll place a hold and

  • So now we'll see that this patron has a hold on the item and again other customers can continue placing

  • Hold and so we'll basically have a queue here of hold so that when our

  • Customer tomas here checks the item back in

  • it gets checked out automatically to the first person who had a hold on it a new checkout history record is created and

  • The Q obviously drops one of the patrons so again if this is checked in by Mary Lee

  • Is now automatically checked out and if you checked it in

  • The book is back to being available for checkout. We can also very simply mark it mark the item is lost

  • Not at which point. It can't be checked out can Margaret sound again

  • So that's our kind of simple check-in checkout system

  • To go back home and we click patrons now

  • We can see how we can manage different patrons that are in our system, so we can see their overdue fees

  • What library cards are associated with what library branch there so sid live if we click on one of the customers here?

  • We can see their name address

  • It's an explanation that they might supply when they sign up for a library card

  • as well as the current items they have checked out and any assets that they have placed a hold on we can also see if

  • The customer has any fees on their account

  • It will show up and read on their profile page here

  • So we can see that this customer has fees due and then so we can base some logic on this and say

  • Like if the customer has a certain amount of seeds on their account

  • They might not be able to check out a book or a video just a small other feature we have here some other information

  • We have on our patron object and finally if we take a look over at our branches page. We have another list view here

  • Where we have some data about the branch how many patrons are associated with a number of assets that are associated with it?

  • Whether or not it is open

  • And if we click on it, we can see a picture

  • It's scheduled so the dates between which the branch is open

  • the Total value of the Assets owned by the Branch and some more data so like the description and

  • some sort of profile data on this particular branch and so each of the branches will have its own sort of profile page and

  • The specific Data associated with it

  • So yeah, this is our simple integrated library system or library management system, and it's kind of fun to build it's pretty straightforward application

  • It's not very large

  • but it's actually it would be a fairly decent starting point for an

  • Actual system that managed sort of any type of inventory or any type of check-in checkout system. Where you have patrons?

  • Various locations and various assets to control so I think it's kind of a good general purpose project

  • Particularly if you are interested in learning about the MVC pattern or just diving into some net

  • okay, so I have visual Studio open here and

  • So we'll go ahead and create a new project. So just file new project and

  • we're going to create an asp.net core web application and

  • I'm just going to call it library, and I'll place this in a projects directory that I have here

  • and

  • We'll make sure that it creates a new git repo and creates a directory for the solution

  • So we'll select ok and it's going to ask us if we'd like to use a template and we're going to use the web

  • application template which is going to allow us to create an asp.net core application with

  • MVC

  • Okay, so you can see that by default here with this template

  • we have a project structure in place already, and if you've developed in asp.net before this may look a little bit different to you if

  • you're coming to dotnet core for the first time so

  • Something that you'll notice here. Is that we have a wwe?

  • And that's going to contain all of our static files so csS images Javascript

  • Third-Party libraries, and you can see that the template has brought in jquery and bootstrap, and yeah

  • So we can actually use this directory to serve up our static files

  • When it comes time to load some of those a little bit later, and then we have directories for our

  • controllers and views and

  • so the template has provided us with the home controller and

  • Some views for the home controller here as well as some shared views so a layout and a narrow page here

  • So the layout that's the htML. This is actually going to be shared by all the other views in our system, and so you'll see

  • That we are implementing razr Syntax here

  • So anytime you see a spiral and then some keyword here, we're going to be using new razor

  • templating engine and

  • So that we can dynamically render htML on a page in these Cs. HtML files so you'll notice that?

  • Towards the middle of the page here after we define the head and the body tags and we have a navbar

  • Inside of this dIV with the class container body content

  • We have this render body method that's being called after the spiral here

  • And so this is actually where all of our views will be rendered by default in our application. So very quickly

  • we'll take a look at the application that the template has provided us with and we can just fire up the

  • Browser clicking the iis Express button up here with a play button you

  • Can also hit F5 as long as the library is set to your start up project?

  • Okay, so the browser is going to pop up here, and I'll just maximize it

  • It may take a little bit longer to fire up the application if this is the first time that it's being built and it's worth

  • noting that unlike in some scripting languages of you're familiar with

  • Developing web applications in Django using python or in a particular

  • Javascript framework if you have a small node server running

  • We're actually going to need to stop and start or sort of anytime we work on

  • Compiled codes of things like code that's in our controllers and models, okay?

  • So we have the application up here

  • And you can see that it has created a simple home page for us that has a sort of carousel slider here

  • And then we have a nav bar up top here with home about and contact link

  • So if we click on these and notice that pages are getting rendered for us if you take a look at the url in

  • A browser you can see that all the links that we click on here are relative to this home path

  • so home is the controller that our application is using in this particular case and

  • Then the action will be the second part of our path here

  • so home slash about is going to look in the home controller for an about action and

  • home Slash contact is going to be looking in the home controller for a contact action and

  • Then our Index page looks like it's rendering

  • Probably the index section on the home controller by default when we have nothing in our route here

  • So let's take a look at where that's configured, so I'm just going to close the browser and hit stop and we'll come down here

  • to

  • Will close our view and controller folders, and we'll come down here to the startup that's es file

  • Which contains our startup class?

  • and

  • this class contains a constructor and two methods the configure services method and

  • configure method if we look inside the configure method you can see where we are actually telling the application how to

  • do its routing so we have a default route here where the controller is going to be set to home and

  • then we'll have slash index slash and optional id that might get passed years you can imagine that we might have for example like a

  • detail view where if we had say like an iMages controller and then select images and then

  • Tale action where we were going to pass the id of a particular image?

  • Then we could go to like a detail page for that image

  • Let's talk a little bit about this startup class as a whole so again

  • if you've developed an asp.net application in the past you may be familiar with

  • Seeing like a ab dot config file and a global

  • Sx file here in your project structure everything now is going to be handled inside of our startup dot CS class and

  • You'll notice that in the constructor for this class

  • We are actually going to be building all the configuration for this application

  • using this configuration builder class and

  • So all the configuration is going to be stored in a series of JSon files that might contain any

  • Configurations that we set for application

  • And so we'll have pairs of keys and values in

  • Json files that will represent the various configuration values that we might need to use and

  • If we have new Json files that we'd like to add to our application. We can actually

  • Just chain another adjacent file method here onto our configuration builder to apply those configurations

  • So that's pretty straightforward note also that we can add environment variables to our configuration builder

  • which is kind of nice because we could store things like database passwords Connection strings or any other type of

  • Configuration that might be particularly an environment that our application is deployed to