← Back
IAmTimCorey June 17, 2026 19m

Adding the Add Tickets Form - C# on Linux Episode 24

Read full transcript 17 segments
  1. Now we have a page displaying all of our Now we have a page displaying all of our tickets. Let's create a way to add new tickets. Let's create a way to add new tickets. Let's create a way to add new tickets to our database. tickets to our database. tickets to our database. This video is part of a series dedicated This video is part of a series dedicated This video is part of a series dedicated developing C# applications on Linux. developing C# applications on Linux. developing C# applications on Linux. Currently, we're almost done building a Currently, we're almost done building a Currently, we're almost done building a full application called the ticket app. full application called the ticket app. full application called the ticket app. Now on the way we've gained a better Now on the way we've gained a better Now on the way we've gained a better knowledge of how Linux works and how to knowledge of how Linux works and how to knowledge of how Linux works and how to make our apps truly cross-platform. If make our apps truly cross-platform. If make our apps truly cross-platform. If you haven't already subscribed to this you haven't already subscribed to this you haven't already subscribed to this channel, then go ahead and do that so channel, then go ahead and do that so channel, then go ahead and do that so you stay informed of new episodes as you stay informed of new episodes as you stay informed of new episodes as they come out. And if you're looking for they come out. And if you're looking for they come out. And if you're looking for even more .NET, SQL, or C# training, go even more .NET, SQL, or C# training, go even more .NET, SQL, or C# training, go to IamTimCorey.com. to IamTimCorey.com. to IamTimCorey.com. The funds from the courses there help The funds from the courses there help The funds from the courses there help pay for this free content. pay for this free content. pay for this free content. So, let's dive back in. We're going to So, let's dive back in. We're going to So, let's dive back in. We're going to go back to the web project, back to the go back to the web project, back to the go back to the web project, back to the components, pages, and our tickets components, pages, and our tickets components, pages, and our tickets component. component. component. We're going to just kind of live in here We're going to just kind of live in here We're going to just kind of live in here for this episode. What we're going to do for this episode. What we're going to do for this episode. What we're going to do is we're going to minimize these and is we're going to minimize these and is we're going to minimize these and we're going to set up the way to create we're going to set up the way to create we're going to set up the way to create new tickets. And I'm going to do this in new tickets. And I'm going to do this in new tickets. And I'm going to do this in two parts. One, the code first so we two parts. One, the code first so we two parts. One, the code first so we have everything we need, and then we'll have everything we need, and then we'll have everything we need, and then we'll create the the Razor syntax for it. So, create the the Razor syntax for it. So, create the the Razor syntax for it. So, first up what we're going to do is we're first up what we're going to do is we're first up what we're going to do is we're going to say private ticket insert model going to say private ticket insert model going to say private ticket insert model is new ticket.

  2. is new ticket. is new ticket. And we'll say equals new. And we'll say equals new. And we'll say equals new. Okay. Now, this is Okay. Now, this is Okay. Now, this is uh VS Code is just saying, "Hey, this is uh VS Code is just saying, "Hey, this is uh VS Code is just saying, "Hey, this is what that is." what that is." what that is." But we don't have to We don't I wish it But we don't have to We don't I wish it But we don't have to We don't I wish it wouldn't show that, honestly. But um wouldn't show that, honestly. But um wouldn't show that, honestly. But um the one thing I do want to say is that the one thing I do want to say is that the one thing I do want to say is that let's go back over here and look at our let's go back over here and look at our let's go back over here and look at our models real quick. Cuz I I do have one models real quick. Cuz I I do have one models real quick. Cuz I I do have one thought, and that is for the insert thought, and that is for the insert thought, and that is for the insert model, we have no default value for model, we have no default value for model, we have no default value for priority. Let's set that default value priority. Let's set that default value priority. Let's set that default value to five. to five. to five. Then we have a default value. We don't Then we have a default value. We don't Then we have a default value. We don't have to set it every time in here, and have to set it every time in here, and have to set it every time in here, and we know that by default it's the lowest we know that by default it's the lowest we know that by default it's the lowest possible priority. So, if they don't put possible priority. So, if they don't put possible priority. So, if they don't put anything, it's a low priority. anything, it's a low priority. anything, it's a low priority. Okay. Private bool is saving. What this Okay. Private bool is saving. What this Okay. Private bool is saving. What this is going to do is we're going to track is going to do is we're going to track is going to do is we're going to track to see and let's default this to false. to see and let's default this to false. to see and let's default this to false. Um we're going to track anytime we are Um we're going to track anytime we are Um we're going to track anytime we are saving a form. So, anytime it's doing saving a form. So, anytime it's doing saving a form. So, anytime it's doing any work, we're going to disable any work, we're going to disable any work, we're going to disable buttons. That way you can't accidentally buttons. That way you can't accidentally buttons. That way you can't accidentally double click a button um and save double click a button um and save double click a button um and save something twice and have two records something twice and have two records something twice and have two records inserted in the database. So, the other inserted in the database. So, the other inserted in the database. So, the other thing we're going to do is have a thing we're going to do is have a thing we're going to do is have a private bool private bool private bool create form.

  3. create form. create form. It equals false by default. By default, It equals false by default. By default, It equals false by default. By default, booleans are false, but I like to be booleans are false, but I like to be booleans are false, but I like to be explicit here just to be very clear as explicit here just to be very clear as explicit here just to be very clear as to what's going on. And what this is to what's going on. And what this is to what's going on. And what this is going to do is we're going to have a going to do is we're going to have a going to do is we're going to have a form for creating a new record, but that form for creating a new record, but that form for creating a new record, but that form by default is not shown. So, we form by default is not shown. So, we form by default is not shown. So, we only show it once we are um once we're only show it once we are um once we're only show it once we are um once we're done. So, let's come down here um and done. So, let's come down here um and done. So, let's come down here um and I'm going to say private I'm going to say private I'm going to say private async task async task async task and we'll say create ticket async. and we'll say create ticket async. and we'll say create ticket async. So, this is when we are actually ready So, this is when we are actually ready So, this is when we are actually ready to save our ticket. Uh oops, async task to save our ticket. Uh oops, async task to save our ticket. Uh oops, async task space. There we go. Um this is where space. There we go. Um this is where space. There we go. Um this is where we're ready to save our ticket. So, we we're ready to save our ticket. So, we we're ready to save our ticket. So, we have our ticket insert model done have our ticket insert model done have our ticket insert model done um and we're going to do a try catch um and we're going to do a try catch um and we're going to do a try catch here. here. here. And we're going to say is saving equals And we're going to say is saving equals And we're going to say is saving equals true, so that disables the buttons. And true, so that disables the buttons. And true, so that disables the buttons. And we're going to say error message equals we're going to say error message equals we're going to say error message equals null, so a fresh start on our error null, so a fresh start on our error null, so a fresh start on our error message. We're going to say await message. We're going to say await message. We're going to say await and we're going to say ticket API. dive and we're going to say ticket API. dive and we're going to say ticket API. dive create ticket async with the new ticket that we just created. And then we're that we just created. And then we're going to say, let's reset that new going to say, let's reset that new going to say, let's reset that new ticket. So, uh uh new ticket ticket. So, uh uh new ticket ticket. So, uh uh new ticket equals new.

  4. equals new. equals new. And that resets that back to a fresh new And that resets that back to a fresh new And that resets that back to a fresh new ticket. ticket. ticket. Um but let's do that let's Um but let's do that let's Um but let's do that let's get our order right here. Show create get our order right here. Show create get our order right here. Show create form equals false. So, stop the form form equals false. So, stop the form form equals false. So, stop the form from being shown, then reset our ticket from being shown, then reset our ticket from being shown, then reset our ticket model, and then await load tickets model, and then await load tickets model, and then await load tickets async. Remember I said before, we're async. Remember I said before, we're async. Remember I said before, we're going to call this method again whenever going to call this method again whenever going to call this method again whenever we create a new ticket or doing any we create a new ticket or doing any we create a new ticket or doing any modifications, that way we always have modifications, that way we always have modifications, that way we always have the latest data from the database. That the latest data from the database. That the latest data from the database. That way we could assume, and that's what we way we could assume, and that's what we way we could assume, and that's what we do sometimes, especially if we're doing do sometimes, especially if we're doing do sometimes, especially if we're doing a client-side app like a JavaScript or a client-side app like a JavaScript or a client-side app like a JavaScript or web assembly app. web assembly app. web assembly app. We might assume that this ticket got We might assume that this ticket got We might assume that this ticket got created and therefore you just just just created and therefore you just just just created and therefore you just just just display it. But, it wouldn't have an ID display it. But, it wouldn't have an ID display it. But, it wouldn't have an ID and it wouldn't have a create date on and it wouldn't have a create date on and it wouldn't have a create date on it. it. it. Um Um Um and then the next time you go to the and then the next time you go to the and then the next time you go to the database, we just, you know, load that database, we just, you know, load that database, we just, you know, load that up. But, up. But, up. But, here we're not going to do that. We're here we're not going to do that. We're here we're not going to do that. We're going to say, you know, let's go to the going to say, you know, let's go to the going to say, you know, let's go to the database and figure out what all the database and figure out what all the database and figure out what all the tickets are because maybe it didn't get tickets are because maybe it didn't get tickets are because maybe it didn't get created. Maybe there was an exception created. Maybe there was an exception created. Maybe there was an exception that happened. Or maybe it half created, that happened. Or maybe it half created, that happened. Or maybe it half created, but there was a problem with something.

  5. but there was a problem with something. but there was a problem with something. Whatever the case may be, we're going to Whatever the case may be, we're going to Whatever the case may be, we're going to get the latest information from the get the latest information from the get the latest information from the database. Now, database. Now, database. Now, if you if you if you this could be expensive, right? So, this this could be expensive, right? So, this this could be expensive, right? So, this could be very expensive if you're always could be very expensive if you're always could be very expensive if you're always loading from the database and there's a loading from the database and there's a loading from the database and there's a a huge list. Um please please please do a huge list. Um please please please do a huge list. Um please please please do not load thousands of tickets onto a not load thousands of tickets onto a not load thousands of tickets onto a page. That's just not efficient. page. That's just not efficient. page. That's just not efficient. However, However, However, um if you have, like we do, a personal um if you have, like we do, a personal um if you have, like we do, a personal tickets form that's not anything that's tickets form that's not anything that's tickets form that's not anything that's going to be, you know, for a large group going to be, you know, for a large group going to be, you know, for a large group of people, well, then this is fine. of people, well, then this is fine. of people, well, then this is fine. Um if you have, you know, even a couple Um if you have, you know, even a couple Um if you have, you know, even a couple hundred records, not a problem. But, if hundred records, not a problem. But, if hundred records, not a problem. But, if you get more than that, you probably you get more than that, you probably you get more than that, you probably have to do paging or something else. And have to do paging or something else. And have to do paging or something else. And that's where you could do that in this that's where you could do that in this that's where you could do that in this load ticket async logic where you'd say, load ticket async logic where you'd say, load ticket async logic where you'd say, "Okay, we're on page three, so reload "Okay, we're on page three, so reload "Okay, we're on page three, so reload just page three and then display that." just page three and then display that." just page three and then display that." Um and then, [clears throat] you know, Um and then, [clears throat] you know, Um and then, [clears throat] you know, every time you change pages, it would go every time you change pages, it would go every time you change pages, it would go and get the new data. We could also do and get the new data. We could also do and get the new data. We could also do things like using caching, etc. But for things like using caching, etc. But for things like using caching, etc. But for us, for this small amount of data, it's us, for this small amount of data, it's us, for this small amount of data, it's not a problem. not a problem. not a problem. Okay. So, we're going to do a catch here Okay. So, we're going to do a catch here Okay. So, we're going to do a catch here and we're going to say exception ex and we're going to say exception ex and we're going to say exception ex and and and then we're going to say error message equals and our string interpolation equals and our string interpolation failed to create ticket.

  6. failed to create ticket. failed to create ticket. Unlike before where we had failure to Unlike before where we had failure to Unlike before where we had failure to load tickets, I believe. load tickets, I believe. load tickets, I believe. Um and we're going to say this is ex Okay? But we're not quite done. Remember Okay? But we're not quite done. Remember we have the is saving is true here. We we have the is saving is true here. We we have the is saving is true here. We want to go to our finally here. That want to go to our finally here. That want to go to our finally here. That way, regardless of what happens, whether way, regardless of what happens, whether way, regardless of what happens, whether we created or not, is saving equals we created or not, is saving equals we created or not, is saving equals false. We're done. So, we're done false. We're done. So, we're done false. We're done. So, we're done saving. Therefore, saving. Therefore, saving. Therefore, um we can go ahead and um we can go ahead and um we can go ahead and um um um and be done. Now, and be done. Now, and be done. Now, because of the fact we have an because of the fact we have an because of the fact we have an exception, we're going to we're going to exception, we're going to we're going to exception, we're going to we're going to probably probably probably um um um not still be showing our form. Because not still be showing our form. Because not still be showing our form. Because the exception's probably going to happen the exception's probably going to happen the exception's probably going to happen right here. We go to save the ticket. right here. We go to save the ticket. right here. We go to save the ticket. So, we won't hide the form, we won't So, we won't hide the form, we won't So, we won't hide the form, we won't create a new ticket, and won't load the create a new ticket, and won't load the create a new ticket, and won't load the tickets yet. So, that's okay. We want it tickets yet. So, that's okay. We want it tickets yet. So, that's okay. We want it to stop right here if it that's where it to stop right here if it that's where it to stop right here if it that's where it failed, because maybe we can just tweak failed, because maybe we can just tweak failed, because maybe we can just tweak the data or something. Maybe you forgot the data or something. Maybe you forgot the data or something. Maybe you forgot to fill in a field or something like to fill in a field or something like to fill in a field or something like that. Um but if an exception happened that. Um but if an exception happened that. Um but if an exception happened here, well, then it would have here, well, then it would have here, well, then it would have um stopped showing the form and it would um stopped showing the form and it would um stopped showing the form and it would have created a new model, which is fine, have created a new model, which is fine, have created a new model, which is fine, because it had a problem loading the the because it had a problem loading the the because it had a problem loading the the form data. So, form data. So, form data. So, um um um that's where it actually this one has a that's where it actually this one has a that's where it actually this one has a a try catch in it. So, even there we a try catch in it. So, even there we a try catch in it. So, even there we shouldn't have an exception. So, it shouldn't have an exception. So, it shouldn't have an exception. So, it should be the only place you have an should be the only place you have an should be the only place you have an exception is right here.

  7. exception is right here. exception is right here. Um just so you know, but these are all Um just so you know, but these are all Um just so you know, but these are all good things to test. good things to test. good things to test. Okay. So, that should be all the code we Okay. So, that should be all the code we Okay. So, that should be all the code we need for creating the ticket, but we're need for creating the ticket, but we're need for creating the ticket, but we're not done yet in our code. Let's minimize not done yet in our code. Let's minimize not done yet in our code. Let's minimize this. Um actually let's not because I this. Um actually let's not because I this. Um actually let's not because I believe we hit enter here. Yeah, it puts believe we hit enter here. Yeah, it puts believe we hit enter here. Yeah, it puts the puts the line in the wrong spot when the puts the line in the wrong spot when the puts the line in the wrong spot when you're collapsed. So, you have to come you're collapsed. So, you have to come you're collapsed. So, you have to come down below the curly brace and put your down below the curly brace and put your down below the curly brace and put your empty lines and then collapse. It's a empty lines and then collapse. It's a empty lines and then collapse. It's a little quirky. But, um you can always little quirky. But, um you can always little quirky. But, um you can always put put put you know, in front of line 103 and hit you know, in front of line 103 and hit you know, in front of line 103 and hit your line returns there. But, we're your line returns there. But, we're your line returns there. But, we're going to have a private void show create going to have a private void show create going to have a private void show create form. form. form. Okay? And what this going to do is say Okay? And what this going to do is say Okay? And what this going to do is say show show show create form equals true. create form equals true. create form equals true. I could do it in line and I'll create a I could do it in line and I'll create a I could do it in line and I'll create a method for it. Um and pri- one more method for it. Um and pri- one more method for it. Um and pri- one more private void cancel create. private void cancel create. private void cancel create. And this is similar in the fact we're And this is similar in the fact we're And this is similar in the fact we're going to say show create form going to say show create form going to say show create form equals false, but before that we're also equals false, but before that we're also equals false, but before that we're also going to say new ticket equals new.

  8. going to say new ticket equals new. going to say new ticket equals new. And the reason why is because if you And the reason why is because if you And the reason why is because if you have filled it out, you want to wipe have filled it out, you want to wipe have filled it out, you want to wipe that out. that out. that out. So, there are the three methods we need. So, there are the three methods we need. So, there are the three methods we need. Now we can do is we can come back to the Now we can do is we can come back to the Now we can do is we can come back to the top and start using these methods. Let's top and start using these methods. Let's top and start using these methods. Let's collapse these down. collapse these down. collapse these down. Um now I can start using these methods. Um now I can start using these methods. Um now I can start using these methods. We'll come right up here and what we're We'll come right up here and what we're We'll come right up here and what we're going to do is I'm going to put this uh going to do is I'm going to put this uh going to do is I'm going to put this uh probably probably probably probably right here above the tickets. probably right here above the tickets. probably right here above the tickets. So, above where um So, above where um So, above where um where we have our where we have our where we have our uh you know, loading or no tickets uh you know, loading or no tickets uh you know, loading or no tickets found. found. found. We're going to have above that the We're going to have above that the We're going to have above that the ability to edit. ability to edit. ability to edit. But, below our message. So, add if But, below our message. So, add if But, below our message. So, add if show create form show create form show create form is false. So, it's false, we're going to have a So, it's false, we're going to have a button. button. button. Uh Uh Uh type equals type equals type equals button button button and class equals btn btn- I think and class equals btn btn- I think and class equals btn btn- I think primary is fine.

  9. primary is fine. primary is fine. Um and then margin Um and then margin Um and then margin margin bottom four? margin bottom four? margin bottom four? Um we'll see. Um we'll see. Um we'll see. Uh we'll see what we want to have for Uh we'll see what we want to have for Uh we'll see what we want to have for the I think that's probably right. Um the I think that's probably right. Um the I think that's probably right. Um but then we have disabled but then we have disabled but then we have disabled equals at whoop, in quotes, at is equals at whoop, in quotes, at is equals at whoop, in quotes, at is saving. saving. saving. Okay, so it's going to be disabled if Okay, so it's going to be disabled if Okay, so it's going to be disabled if the saving is true. the saving is true. the saving is true. And then we have a on click And then we have a on click And then we have a on click equals equals equals uh show create form. And then And then create ticket. create ticket. create ticket. And let's go ahead and at least put this And let's go ahead and at least put this And let's go ahead and at least put this on its own line on its own line on its own line with the with the with the button um button um button um like that. That's still a very long like that. That's still a very long like that. That's still a very long line, so I'll probably um line, so I'll probably um line, so I'll probably um I'll probably at least put I'll probably at least put I'll probably at least put two lines there like that. Um two lines there like that. Um two lines there like that. Um I might want to put them all on their I might want to put them all on their I might want to put them all on their own line, but I think that's probably own line, but I think that's probably own line, but I think that's probably fine. Um so, this is the button. It's fine. Um so, this is the button. It's fine. Um so, this is the button. It's going to be for creating tickets. And if going to be for creating tickets. And if going to be for creating tickets. And if the show create form is false, we have the show create form is false, we have the show create form is false, we have this button that says, "Hey, you want to this button that says, "Hey, you want to this button that says, "Hey, you want to create a ticket?"

  10. create a ticket?" create a ticket?" And then if is true, we're going to show the form itself. we're going to show the form itself. So, here's the the form we have in the So, here's the the form we have in the So, here's the the form we have in the edit form. edit form. edit form. And we're going to say model And we're going to say model And we're going to say model equals new ticket equals new ticket equals new ticket in quotes. And the on valid submit is going to be And the on valid submit is going to be create ticket a sync. Um we don't have create ticket a sync. Um we don't have create ticket a sync. Um we don't have an on invalid submit, but an on invalid submit, but an on invalid submit, but I'm going to leave it. Um and class I'm going to leave it. Um and class I'm going to leave it. Um and class equals equals equals uh margin bottom of four match that uh margin bottom of four match that uh margin bottom of four match that button. button. button. So the button's going away. So the button's going away. So the button's going away. Okay. So there's an edit form in there Okay. So there's an edit form in there Okay. So there's an edit form in there we're going to have our data annotations we're going to have our data annotations we're going to have our data annotations validator. validator. validator. And the validation summary. summary. So we're not going to worry about doing So we're not going to worry about doing So we're not going to worry about doing per row validation or per uh field per row validation or per uh field per row validation or per uh field validation. We're just going to do validation. We're just going to do validation. We're just going to do validation at the top. validation at the top. validation at the top. And then we're going to say And then we're going to say And then we're going to say uh div class and I've kind of mapped uh div class and I've kind of mapped uh div class and I've kind of mapped that you beforehand. Um because I don't that you beforehand. Um because I don't that you beforehand. Um because I don't think you need to be sitting here think you need to be sitting here think you need to be sitting here guessing and you know, do live changes, guessing and you know, do live changes, guessing and you know, do live changes, but uh row uh gutter of three align but uh row uh gutter of three align but uh row uh gutter of three align items end items end items end like so.

  11. like so. like so. And then we're going to have a div class And then we're going to have a div class And then we're going to have a div class equals uh call medium three. equals uh call medium three. equals uh call medium three. Like so. Like so. Like so. And then we'll have in there a label And then we'll have in there a label And then we'll have in there a label class equals form label. And four equals And four equals uh new {dash} title. And we'll call this title. And we'll call this title. And we're going to have input text. And we're going to have input text. And we're going to have input text. If you're looking at this and going that If you're looking at this and going that If you're looking at this and going that doesn't look like HTML, it looks like doesn't look like HTML, it looks like doesn't look like HTML, it looks like something else. That's C# actually. something else. That's C# actually. something else. That's C# actually. That's actually razor syntax. Input text That's actually razor syntax. Input text That's actually razor syntax. Input text has some additional things to our text has some additional things to our text has some additional things to our text field and then anything it doesn't know field and then anything it doesn't know field and then anything it doesn't know about, it just passes on to the actual about, it just passes on to the actual about, it just passes on to the actual input box. So uh, ID equals new title. input box. So uh, ID equals new title. input box. So uh, ID equals new title. Because what's going to happen in the Because what's going to happen in the Because what's going to happen in the actual page is just an input of type actual page is just an input of type actual page is just an input of type equals text.

  12. equals text. equals text. So, uh, class equals form-control. So, uh, class equals form-control. So, uh, class equals form-control. And then at bind {dash} value And then at bind {dash} value And then at bind {dash} value equals new ticket equals new ticket equals new ticket {dot} {dot} {dot} ticket title. Okay? And we're going to self-close Okay? And we're going to self-close that. that. that. And that is our first entry. Now, this And that is our first entry. Now, this And that is our first entry. Now, this is going to be an inline form. I want it is going to be an inline form. I want it is going to be an inline form. I want it to be inline, not stacked. So, the next to be inline, not stacked. So, the next to be inline, not stacked. So, the next one will use, um, actually four one will use, um, actually four one will use, um, actually four uh, four. And this is going to be the uh, four. And this is going to be the uh, four. And this is going to be the description. New description. New description. This is where copy and pasting can This is where copy and pasting can This is where copy and pasting can really bite you. Uh, be careful. And this is going to be uh, ticket And this is going to be uh, ticket description. description. description. Like so. Like so. Like so. So, next up, actually, you know what? So, next up, actually, you know what? So, next up, actually, you know what? Let's put it on new lines.

  13. Let's put it on new lines. Let's put it on new lines. Yeah, it's starting to make this field Yeah, it's starting to make this field Yeah, it's starting to make this field really wide. Um, okay. Next up, what really wide. Um, okay. Next up, what really wide. Um, okay. Next up, what we'll do is we'll paste again, this time we'll do is we'll paste again, this time we'll do is we'll paste again, this time the markdown or medium column is going the markdown or medium column is going the markdown or medium column is going to be two. And instead of title, this is to be two. And instead of title, this is to be two. And instead of title, this is priority. So, priority. So, priority. And this is priority. See how easy it is to miss these things? See how easy it is to miss these things? Um, Um, Um, and I'm going to tab this in and I'm and I'm going to tab this in and I'm and I'm going to tab this in and I'm going to say, going to say, going to say, uh, priority. uh, priority. uh, priority. But this is not input text, this is But this is not input text, this is But this is not input text, this is input number. There we go. There we go. So, input number, um, just allows us to So, input number, um, just allows us to So, input number, um, just allows us to have a number field, a numeric field, have a number field, a numeric field, have a number field, a numeric field, instead of having a a text field. instead of having a a text field. instead of having a a text field. And last up, we're going to have I'm And last up, we're going to have I'm And last up, we're going to have I'm going to paste in that one have that going to paste in that one have that going to paste in that one have that that call um set up. It is three, but that call um set up. It is three, but that call um set up. It is three, but we're going to have two buttons. we're going to have two buttons. we're going to have two buttons. Button Button Button type equals submit.

  14. type equals submit. type equals submit. And class equals btn btn-primary. And also margin end of And also margin end of margin end of margin end of margin end of two. two. two. And then disabled. And then disabled. And then disabled. There we go. Equals There we go. Equals There we go. Equals in quotes at is saving. So again, in quotes at is saving. So again, in quotes at is saving. So again, disable the button if we're saving this disable the button if we're saving this disable the button if we're saving this and say save ticket. and say save ticket. and say save ticket. And then one more. And then one more. And then one more. This is also a button. This is also a button. This is also a button. Type equals button. Type equals button. Type equals button. And the class equals btn and And the class equals btn and And the class equals btn and btn-secondary. And this also is disabled equals at is And this also is disabled equals at is saving. saving. saving. >> [snorts] >> [snorts] >> [snorts] >> And this is going to have a at on click. That's going to be cancel create That's going to be cancel create with a cancel.

  15. with a cancel. with a cancel. And this should be let's um And this should be let's um And this should be let's um >> [snorts] >> [snorts] >> [snorts] >> make this a couple lines here. >> make this a couple lines here. >> make this a couple lines here. Because this is just too much. Like so. Like so. Um let's Um let's Um let's do the same thing here. do the same thing here. do the same thing here. So So now we have two buttons. We have a So So now we have two buttons. We have a So So now we have two buttons. We have a submit button. submit button. submit button. Which notice there's no like C# Which notice there's no like C# Which notice there's no like C# activity. That's because if the type is activity. That's because if the type is activity. That's because if the type is submit, the submit action is for this submit, the submit action is for this submit, the submit action is for this um this form here, edit form. So on um this form here, edit form. So on um this form here, edit form. So on valid submit create ticket async. So valid submit create ticket async. So valid submit create ticket async. So that's what it does on a submit button. that's what it does on a submit button. that's what it does on a submit button. We don't have to do anything else. We don't have to do anything else. We don't have to do anything else. But, for this button, we have this But, for this button, we have this But, for this button, we have this calling the on click cancel create, so calling the on click cancel create, so calling the on click cancel create, so we can cancel out the creation if we can cancel out the creation if we can cancel out the creation if there's um a request to do so. there's um a request to do so. there's um a request to do so. So, with that, I think that's it. So, So, with that, I think that's it. So, So, with that, I think that's it. So, what we're going to do is come over here what we're going to do is come over here what we're going to do is come over here and run this, make sure it does run, and and run this, make sure it does run, and and run this, make sure it does run, and we can create a new ticket. we can create a new ticket. we can create a new ticket. So, always validate what you're doing, So, always validate what you're doing, So, always validate what you're doing, make sure it works. But, make sure it works. But, make sure it works. But, I'm not showing the full process here I'm not showing the full process here I'm not showing the full process here for a number of reasons. Uh the biggest for a number of reasons. Uh the biggest for a number of reasons. Uh the biggest one is just time. But, you want to make one is just time. But, you want to make one is just time. But, you want to make sure that you are putting testing in sure that you are putting testing in sure that you are putting testing in place and doing some good QA on the QA place and doing some good QA on the QA place and doing some good QA on the QA on this, so that you don't just test the on this, so that you don't just test the on this, so that you don't just test the happy path, but make sure that you test happy path, but make sure that you test happy path, but make sure that you test that things don't break for other that things don't break for other that things don't break for other reasons.

  16. reasons. reasons. Okay. So, you know, test those exception Okay. So, you know, test those exception Okay. So, you know, test those exception messages, all the rest. So, we have this messages, all the rest. So, we have this messages, all the rest. So, we have this button now called create tickets button now called create tickets button now called create tickets or create ticket. This pops up this or create ticket. This pops up this or create ticket. This pops up this form. Um I can say, "This is our new form. Um I can say, "This is our new form. Um I can say, "This is our new um is our new ticket." um is our new ticket." um is our new ticket." Um Um Um >> [clears throat] >> [clears throat] >> [clears throat] >> testing out the new ticket creation. >> testing out the new ticket creation. >> testing out the new ticket creation. And instead of five, let's um And instead of five, let's um And instead of five, let's um I noticed the exception message or the I noticed the exception message or the I noticed the exception message or the I'm sorry, not the exception message, I'm sorry, not the exception message, I'm sorry, not the exception message, the validation message says, "Hey, nope, the validation message says, "Hey, nope, the validation message says, "Hey, nope, you're out of range. you're out of range. you're out of range. Um it's a three. Let's do a three. Uh Um it's a three. Let's do a three. Uh Um it's a three. Let's do a three. Uh actually, we don't have four. So, let's actually, we don't have four. So, let's actually, we don't have four. So, let's create a four." create a four." create a four." We hit create ticket. And there we go. We hit create ticket. And there we go. We hit create ticket. And there we go. There's our new ticket. Testing new There's our new ticket. Testing new There's our new ticket. Testing new creation process. Again, don't worry creation process. Again, don't worry creation process. Again, don't worry about the ID numbers. Leave them alone. about the ID numbers. Leave them alone. about the ID numbers. Leave them alone. They're fine. Um and it's created on 6/8 They're fine. Um and it's created on 6/8 They're fine. Um and it's created on 6/8 with a priority of four. We can create with a priority of four. We can create with a priority of four. We can create again and say, "You know what? Cancel." again and say, "You know what? Cancel." again and say, "You know what? Cancel." Uh we can create again and say, Uh we can create again and say, Uh we can create again and say, you know, something like that, hit you know, something like that, hit you know, something like that, hit cancel, and then you create again, and cancel, and then you create again, and cancel, and then you create again, and that's missing now. So, we're all set.

  17. that's missing now. So, we're all set. that's missing now. So, we're all set. We now have the ability to create new We now have the ability to create new We now have the ability to create new tickets. So, next up, we're going to do tickets. So, next up, we're going to do tickets. So, next up, we're going to do is uh work on modifying tickets. But, is uh work on modifying tickets. But, is uh work on modifying tickets. But, until then, until then, until then, the source code is down in the the source code is down in the the source code is down in the description. And, thanks for watching. description. And, thanks for watching. description. And, thanks for watching. And, as always, I am Tim Corey. And, as always, I am Tim Corey. And, as always, I am Tim Corey. >> [music]

Summary

This tutorial focuses on developing C# applications on Linux by adding a new ticket creation feature to a ticket app. Key topics include setting up models like `TicketInsertModel` with a default priority and using a `isSaving` boolean to prevent duplicate submissions. The practical takeaway is to design user interfaces that prevent accidental double submissions and handle default values gracefully.

View original episode ↗