Reader small image

You're reading from  .NET MAUI Cross-Platform Application Development - Second Edition

Product typeBook
Published inMar 2024
Reading LevelBeginner
PublisherPackt
ISBN-139781835080597
Edition2nd Edition
Languages
Right arrow
Author (1)
Roger Ye
Roger Ye
author image
Roger Ye

Roger Ye is an embedded system programmer who has great interest in virtualization, Android, and cross-platform technologies. His professional experience includes working with major companies like Motorola, Emerson, Intel, and EPAM, where he held the position of Engineering Manager. At Motorola and Emerson, he worked on embedded system projects for mobile devices and telecommunication infrastructures. He is now an engineering manager at EPAM, working with a team to deliver digital solutions for diverse clients.
Read more about Roger Ye

Right arrow

Implementing CRUD operations

After preparing the modal dialogs for CRUD operations, as discussed in the previous sections, we can now proceed to implement these CRUD operations in this section.

CRUD operations of items

To add or update an item, we can utilize the UpdateItemAsync method in Items.razor.cs to accommodate both scenarios. To distinguish between creating a new item and updating an existing one, we define a private _isNewItem field as follows:

    bool _isNewItem = false;

Next, we’ll see how to add or edit an item.

Adding a new item

To add a new item, simply click the + button located in the header of the Items page, as depicted in Figure 10.8:

Figure 9.7: Adding a new item

Figure 10.8: Adding a new item

The Razor markup of this page header can be reviewed here:

<div class="container"><div class="row">
  <div class="col-12"><h1>
    @if (selectedItem?.GetParentLink() != null) {
      <a class="...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
.NET MAUI Cross-Platform Application Development - Second Edition
Published in: Mar 2024Publisher: PacktISBN-13: 9781835080597

Author (1)

author image
Roger Ye

Roger Ye is an embedded system programmer who has great interest in virtualization, Android, and cross-platform technologies. His professional experience includes working with major companies like Motorola, Emerson, Intel, and EPAM, where he held the position of Engineering Manager. At Motorola and Emerson, he worked on embedded system projects for mobile devices and telecommunication infrastructures. He is now an engineering manager at EPAM, working with a team to deliver digital solutions for diverse clients.
Read more about Roger Ye