The document describes how to build a Movie List application using ASP.NET MVC and Entity Framework Core by explaining how to set up the model classes, controllers, views, and database context to display, add, edit and delete movie data, relating movies to genres and making the URLs more user-friendly. It provides code examples for each part of the application.
Murach: An introduction to web programming with ASP.NET Core MVCMahmoudOHassouna
Murach: An introduction to web programming with ASP.NET Core MVC
Mary Delamater, Joel Murach - Murach's ASP.NET Core MVC-Mike Murach & Associates, Inc. (2020) (1)
Murach: How to validate data in asp.net core mvcMahmoudOHassouna
- You can validate user-input data in ASP.NET MVC using data attributes on model properties and custom validation attributes. Data attributes like Required, Range, StringLength allow property-level validation, while custom attributes can perform cross-field and custom validation logic.
- Client-side validation is enabled by default and prevents invalid submissions, but server-side validation in the controller is also needed as the only authorization. You can customize validation error messages and UI.
The document describes how to build a Movie List application using ASP.NET MVC and Entity Framework Core by explaining how to set up the model classes, controllers, views, and database context to display, add, edit and delete movie data, relating movies to genres and making the URLs more user-friendly. It provides code examples for each part of the application.
Murach: An introduction to web programming with ASP.NET Core MVCMahmoudOHassouna
Murach: An introduction to web programming with ASP.NET Core MVC
Mary Delamater, Joel Murach - Murach's ASP.NET Core MVC-Mike Murach & Associates, Inc. (2020) (1)
Murach: How to validate data in asp.net core mvcMahmoudOHassouna
- You can validate user-input data in ASP.NET MVC using data attributes on model properties and custom validation attributes. Data attributes like Required, Range, StringLength allow property-level validation, while custom attributes can perform cross-field and custom validation logic.
- Client-side validation is enabled by default and prevents invalid submissions, but server-side validation in the controller is also needed as the only authorization. You can customize validation error messages and UI.
This document discusses different types of adapters and lists in Android. It begins by explaining adapters and the two main types: ArrayAdapter and SimpleCursorAdapter. It then describes an exercise to create a student grades application using a list view, auto-complete text view, and custom list. The last section discusses four methods for implementing a custom list adapter: 1) using a LayoutInflater, 2) recycling views, 3) using a ViewHolder, and 4) using a RecyclerView. The document provides code examples for creating adapters and lists in each case.
The document introduces cookies and how they are handled in Oracle Application Testing Suite: e-Tester. It discusses the two types of cookies - persistent and session cookies. It also describes how the cookie handling options can be configured on a per-script basis and the implications of these settings for stand-alone versus linked scripts.
The document provides an introduction to Oracle Application Testing Suite e-Load and its features for load testing web applications, including setting up virtual users and profiles, running load tests, and analyzing results. It describes how to configure e-Load settings for aspects like authentication, browser emulation, caching, and download management to simulate real user behavior under load.
This document provides instructions for creating a simple tasklist application using ASP.NET MVC. It describes creating the controller, views, database, and model. The controller contains actions for listing, creating, and completing tasks. Views are created for displaying the task list and creating new tasks. A database with a Tasks table is set up using LINQ to SQL. Logic is added to the controller actions to retrieve and save tasks from the database. The task list view is modified to display tasks from the model.
Data banks in Oracle Application Testing Suite allow test scripts to be iterated multiple times with different input data by mapping form fields to variables populated from an external data file. This enables automated testing of multiple input combinations without manually re-running the test case each time. The data file must be in CSV format and stored in the databank folder. The data bank wizard is used to map parameters to variables and bind variables to data fields to link the script and data file.
This document provides an introduction and overview of ASP.NET Identity. It discusses how ASP.NET Identity is the new membership system for building ASP.NET web applications and allows using social identities like Windows Live, Gmail, Facebook and Twitter for authentication. The document outlines key features of ASP.NET Identity like extended user account definitions, two-factor authentication, account confirmation and management of users and roles. It also lists required packages and describes important pieces of ASP.NET Identity like User, Role, User Manager, Role Manager and Authentication Manager. Finally, it provides references for further reading on ASP.NET Identity.
ASP.NET 03 - Working With Web Server ControlsRandy Connolly
This document provides an overview of the different types of server controls in ASP.NET, including their common properties, methods, and events. It describes HTML server controls, web server controls, validation controls, user controls, and custom server controls. It also discusses some common properties like ID, width and font that are shared across most server controls, and how to programmatically manipulate properties and handle events.
The document describes how to use Mulesoft to connect a CSV file to a Salesforce account. It involves using a File connector to monitor an input folder for CSV files. A Salesforce connector is configured with a username, password and security token. A DataMapper transformer maps the CSV file fields to Salesforce object fields. When run, the application will take CSV contact data from the input folder and upload it to the Salesforce account as new contacts.
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAhsanul Karim
These slides are for self-learners and trainees of my BASIS and DIIT Android course.
I have used information, content and images from various sources. As these materials are for non-commercial use, I think they won’t infringe any copyright issue.
This document provides a tutorial on creating a custom widget in Rational Host Access Transformation Services (HATS). It describes how to create a custom HTML widget that renders an input field and button. The widget is designed to allow adding a button next to an input field to send a mnemonic keyword for a specific purpose, with the button name and keyword configurable via global variables or direct input. The tutorial covers creating the widget Java class, implementing its settings UI and drawHTML() method to generate the HTML output, and provides an example usage transforming an iSeries screen.
- The document discusses techniques for efficient and thread-safe database access from web servers including using synchronized blocks, prepared statements, and connection pooling.
- Synchronized blocks allow only one thread to execute a block of code at a time to prevent race conditions when multiple threads access a shared resource like a database.
- Prepared statements improve efficiency by parsing SQL statements once instead of each time they are executed, allowing values to be bound dynamically.
- Connection pooling reuses existing database connections instead of creating new ones for each request, improving performance.
Day 8: Dealing with Lists and ListViewsAhsanul Karim
The document discusses ListViews and ListActivities in Android. It covers:
- How ListViews display scrollable lists using an Adapter to provide data and layouts
- How ListActivities simplify list handling by predefining list interaction methods
- Implementing ArrayAdapters with standard or custom layouts
- Improving performance by recycling list item views
- Creating custom adapters to define flexible row layouts
- Allowing row views to interact with the underlying data model
Android User Interface: Basic Form WidgetsAhsanul Karim
This document provides a tutorial on creating various user interface elements in Android applications, including buttons, text fields, checkboxes, radio buttons, toggle buttons, rating bars, and auto-complete text views. It includes code examples for adding each element to an app layout and handling user interactions with them.
The document provides an overview of Angular including:
- Angular is an open source JavaScript framework for building web applications in HTML and JavaScript. It provides services and objects to create applications faster.
- Typescript is a programming language that adds optional static typing to JavaScript. It compiles to JavaScript.
- Modules, components, templates, metadata, services, and routes are architectural concepts in Angular that define application structure and functionality.
- Components control views and consist of templates, classes, and metadata. Services provide shared functionality across modules. Routes enable navigation between views.
Crystal Report Configuration Using xCP Designer 2.1Haytham Ghandour
This document provides instructions on how to configure Crystal Reports using the xCelerated Composition Platform (xCP) Designer 2.1. It outlines the steps to create a Crystal Report artifact, configure data sources, design filters, and bind the report to a widget. It also describes how to troubleshoot issues like XML files not generating, data not updating, and limited record counts. Migrating Crystal Reports from xCP 2.0 is also addressed.
Property binding allows binding a property in the component class to an element property in the template. This creates a one-way binding from the class to the view. Examples shown include binding a property to an image src, text color, and CSS class. Event binding allows binding to events in the template to call methods in the class, creating a one-way binding from view to class. Two-way binding is shown using a method to update the class property on input events as well as using ngModel for simpler two-way binding between an input and class property.
This document describes how to perform CRUD (create, read, update, delete) operations on Salesforce using Mule ESB. It outlines the prerequisites, including Anypoint Studio, a Salesforce developer account, and a security token. It then provides steps to create a Salesforce developer account, generate a security token, create a Mule application with flows to create, read, update, and delete a Salesforce contact using the Salesforce connector. Code examples are provided for Java classes and XML configuration to implement the CRUD operations. The document extracts log output showing the operations were executed successfully.
1. The document outlines the basic steps to create simple transformations in Informatica 8.x, including creating a data source name (DSN), directory in the repository, source, target, mapping, workflow, and task.
2. Key steps are importing the source and target tables, generating the target schema, mapping the source and target, creating and executing a workflow and task, and previewing the target data.
3. Executing the workflow in the Workflow Monitor allows you to check if the transformation succeeded or failed.
This document describes the web services provided by the WFA (WFA Web services primer) to interact with and monitor workflows. It outlines 9 different web services covering getting workflows by various criteria, running, resuming, rejecting, and getting the status of workflows. It also covers the security requirements and includes appendices on return parameters and error messages.
The document discusses routing in ASP.NET Core MVC. It defines routing as mapping incoming HTTP requests to specific action methods. It explains that routing allows URLs that are not tied to files, decoupling URLs from action methods. Route templates define URL patterns used to match requests, containing placeholders for varying parts. Route templates map URLs to action methods based on segments.
This document discusses different types of adapters and lists in Android. It begins by explaining adapters and the two main types: ArrayAdapter and SimpleCursorAdapter. It then describes an exercise to create a student grades application using a list view, auto-complete text view, and custom list. The last section discusses four methods for implementing a custom list adapter: 1) using a LayoutInflater, 2) recycling views, 3) using a ViewHolder, and 4) using a RecyclerView. The document provides code examples for creating adapters and lists in each case.
The document introduces cookies and how they are handled in Oracle Application Testing Suite: e-Tester. It discusses the two types of cookies - persistent and session cookies. It also describes how the cookie handling options can be configured on a per-script basis and the implications of these settings for stand-alone versus linked scripts.
The document provides an introduction to Oracle Application Testing Suite e-Load and its features for load testing web applications, including setting up virtual users and profiles, running load tests, and analyzing results. It describes how to configure e-Load settings for aspects like authentication, browser emulation, caching, and download management to simulate real user behavior under load.
This document provides instructions for creating a simple tasklist application using ASP.NET MVC. It describes creating the controller, views, database, and model. The controller contains actions for listing, creating, and completing tasks. Views are created for displaying the task list and creating new tasks. A database with a Tasks table is set up using LINQ to SQL. Logic is added to the controller actions to retrieve and save tasks from the database. The task list view is modified to display tasks from the model.
Data banks in Oracle Application Testing Suite allow test scripts to be iterated multiple times with different input data by mapping form fields to variables populated from an external data file. This enables automated testing of multiple input combinations without manually re-running the test case each time. The data file must be in CSV format and stored in the databank folder. The data bank wizard is used to map parameters to variables and bind variables to data fields to link the script and data file.
This document provides an introduction and overview of ASP.NET Identity. It discusses how ASP.NET Identity is the new membership system for building ASP.NET web applications and allows using social identities like Windows Live, Gmail, Facebook and Twitter for authentication. The document outlines key features of ASP.NET Identity like extended user account definitions, two-factor authentication, account confirmation and management of users and roles. It also lists required packages and describes important pieces of ASP.NET Identity like User, Role, User Manager, Role Manager and Authentication Manager. Finally, it provides references for further reading on ASP.NET Identity.
ASP.NET 03 - Working With Web Server ControlsRandy Connolly
This document provides an overview of the different types of server controls in ASP.NET, including their common properties, methods, and events. It describes HTML server controls, web server controls, validation controls, user controls, and custom server controls. It also discusses some common properties like ID, width and font that are shared across most server controls, and how to programmatically manipulate properties and handle events.
The document describes how to use Mulesoft to connect a CSV file to a Salesforce account. It involves using a File connector to monitor an input folder for CSV files. A Salesforce connector is configured with a username, password and security token. A DataMapper transformer maps the CSV file fields to Salesforce object fields. When run, the application will take CSV contact data from the input folder and upload it to the Salesforce account as new contacts.
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAhsanul Karim
These slides are for self-learners and trainees of my BASIS and DIIT Android course.
I have used information, content and images from various sources. As these materials are for non-commercial use, I think they won’t infringe any copyright issue.
This document provides a tutorial on creating a custom widget in Rational Host Access Transformation Services (HATS). It describes how to create a custom HTML widget that renders an input field and button. The widget is designed to allow adding a button next to an input field to send a mnemonic keyword for a specific purpose, with the button name and keyword configurable via global variables or direct input. The tutorial covers creating the widget Java class, implementing its settings UI and drawHTML() method to generate the HTML output, and provides an example usage transforming an iSeries screen.
- The document discusses techniques for efficient and thread-safe database access from web servers including using synchronized blocks, prepared statements, and connection pooling.
- Synchronized blocks allow only one thread to execute a block of code at a time to prevent race conditions when multiple threads access a shared resource like a database.
- Prepared statements improve efficiency by parsing SQL statements once instead of each time they are executed, allowing values to be bound dynamically.
- Connection pooling reuses existing database connections instead of creating new ones for each request, improving performance.
Day 8: Dealing with Lists and ListViewsAhsanul Karim
The document discusses ListViews and ListActivities in Android. It covers:
- How ListViews display scrollable lists using an Adapter to provide data and layouts
- How ListActivities simplify list handling by predefining list interaction methods
- Implementing ArrayAdapters with standard or custom layouts
- Improving performance by recycling list item views
- Creating custom adapters to define flexible row layouts
- Allowing row views to interact with the underlying data model
Android User Interface: Basic Form WidgetsAhsanul Karim
This document provides a tutorial on creating various user interface elements in Android applications, including buttons, text fields, checkboxes, radio buttons, toggle buttons, rating bars, and auto-complete text views. It includes code examples for adding each element to an app layout and handling user interactions with them.
The document provides an overview of Angular including:
- Angular is an open source JavaScript framework for building web applications in HTML and JavaScript. It provides services and objects to create applications faster.
- Typescript is a programming language that adds optional static typing to JavaScript. It compiles to JavaScript.
- Modules, components, templates, metadata, services, and routes are architectural concepts in Angular that define application structure and functionality.
- Components control views and consist of templates, classes, and metadata. Services provide shared functionality across modules. Routes enable navigation between views.
Crystal Report Configuration Using xCP Designer 2.1Haytham Ghandour
This document provides instructions on how to configure Crystal Reports using the xCelerated Composition Platform (xCP) Designer 2.1. It outlines the steps to create a Crystal Report artifact, configure data sources, design filters, and bind the report to a widget. It also describes how to troubleshoot issues like XML files not generating, data not updating, and limited record counts. Migrating Crystal Reports from xCP 2.0 is also addressed.
Property binding allows binding a property in the component class to an element property in the template. This creates a one-way binding from the class to the view. Examples shown include binding a property to an image src, text color, and CSS class. Event binding allows binding to events in the template to call methods in the class, creating a one-way binding from view to class. Two-way binding is shown using a method to update the class property on input events as well as using ngModel for simpler two-way binding between an input and class property.
This document describes how to perform CRUD (create, read, update, delete) operations on Salesforce using Mule ESB. It outlines the prerequisites, including Anypoint Studio, a Salesforce developer account, and a security token. It then provides steps to create a Salesforce developer account, generate a security token, create a Mule application with flows to create, read, update, and delete a Salesforce contact using the Salesforce connector. Code examples are provided for Java classes and XML configuration to implement the CRUD operations. The document extracts log output showing the operations were executed successfully.
1. The document outlines the basic steps to create simple transformations in Informatica 8.x, including creating a data source name (DSN), directory in the repository, source, target, mapping, workflow, and task.
2. Key steps are importing the source and target tables, generating the target schema, mapping the source and target, creating and executing a workflow and task, and previewing the target data.
3. Executing the workflow in the Workflow Monitor allows you to check if the transformation succeeded or failed.
This document describes the web services provided by the WFA (WFA Web services primer) to interact with and monitor workflows. It outlines 9 different web services covering getting workflows by various criteria, running, resuming, rejecting, and getting the status of workflows. It also covers the security requirements and includes appendices on return parameters and error messages.
The document discusses routing in ASP.NET Core MVC. It defines routing as mapping incoming HTTP requests to specific action methods. It explains that routing allows URLs that are not tied to files, decoupling URLs from action methods. Route templates define URL patterns used to match requests, containing placeholders for varying parts. Route templates map URLs to action methods based on segments.
The document provides an introduction and overview of ASP.NET MVC, covering topics such as routing, controllers, actions, views, and passing data between controllers and views. It compares ASP.NET MVC to traditional ASP.NET WebForms, outlines the MVC architecture and project structure, and describes how routing maps URLs to controller actions. Key aspects of controllers, views, partial views, HTML helpers, and view engines are also summarized.
Mvc interview questions – deep dive jinal desaijinaldesailive
Can you describe ASP.NET MVC Request Life Cycle? 1. Receive request, look up Route object in RouteTable collection and create RouteData object. 2. Create RequestContext instance. 3. Create MvcHandler and pass RequestContext to handler. 4. Identify IControllerFactory from RequestContext. 5. Create instance of class that implements ControllerBase. 6. Call MyController.Execute method. 7. The ControllerActionInvoker determines which action to invoke on the controller and executes the action on the controller, which results in calling the model and returning a view.
.NET Core, ASP.NET Core Course, Session 10aminmesbahi
This document provides an overview of routing in ASP.NET Core, including routing basics, URL matching, URL generation, creating routes, and using routing middleware. It discusses how routing maps requests to route handlers, extracts values from URLs, and generates links. Key concepts covered are route templates, default values, catch-all routes, constraints, and the RouterMiddleware.
.NET 7 is loaded with new features and specially covering Minimal API features like Endpoint Filters,
Route groups, Authentication Improvements, Endpoint metadata providers and
Unit Testing. This PPT covers the basics of API, Minimal API and new features.
If you're new to API and Minimal, you should be able to understand everything.
This document provides an overview of the Iron Router package in Meteor. It discusses key Iron Router concepts like client and server routes, reactivity, rendering templates, layouts, route parameters, subscriptions, and hooks. It also covers options like waitOn, controllers, reactive state, legacy browser support, plugins, and common packages that extend Iron Router functionality.
This document provides an overview and instructions for building a new module in Sahana Eden, an open-source emergency management system. It discusses the model-view-controller architecture, describes how to define models, controllers, and views, and provides an example of building a Vehicle Tracking module from scratch in less than 3 sentences.
This document discusses Angular resolvers, which are used to pre-fetch data before navigating to a component. Angular resolvers implement the Resolve interface to return data via Observable or Promise before the route is activated. An example is provided demonstrating how to create a resolver service to fetch product data from an API, configure routes to use the resolver, and access the resolved data in a component. A loading spinner is also added to improve the user experience while data is loading.
The Model-View-Controller (MVC) pattern separates an application into three main components: the model, the view, and the controller. Routes define URL patterns and handlers, with all configured routes stored in the route table for the routing engine to match requests to handlers. In ASP.NET MVC, the default route is configured in the RouteConfig class to map the URL pattern '{controller}/{action}/{id}' to a controller and action method with a default id parameter.
This document provides an overview and code samples for building an Angular application that manages personal finances. It covers key Angular concepts like modules, components, services, routing, and forms. The full code is available in a GitHub repository and organized into steps that cover setting up the basic layout, using Angular Material for styling, launching modals, building forms to add financial movements, saving data to localStorage, displaying movements and balances, filtering movements, adding charts with Highcharts, and internationalization with NgX-Translate.
Routing maps HTTP requests to controller actions and generates URLs. The config/routes.rb file specifies routing rules which map URLs to controllers and actions. Named routes can be created to simplify URL generation. The 'public' folder serves static files before routing rules are checked.
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Frost
The document provides instructions for building an Angular application with a Golang API and PostgreSQL database. It includes steps to set up the Angular and API projects, configure services and routing in Angular, and build components for item purchase, display, and reporting. The Angular app uses the Golang API to perform CRUD operations on a PostgreSQL database and display the data.
Laravel is a PHP web framework used for building web applications. This document provides an overview of Laravel's installation process, directory structure, routing, controllers, views, and request handling. It explains how to install Laravel using Composer, set up the application key, define routes, create controllers, build and extend views using Blade templates, access request data, and perform validation. The document gives developers a high-level understanding of Laravel's core functionality and features.
Lecture 4_Laravel Controller and Data Pass-Route.pptxSaziaRahman
This document provides an overview of Laravel controllers, including how to create controllers, load views from controllers, pass data between controllers and views, and use Blade syntax in views. Key points include:
- Controllers group related request handling logic and reside in app/Http/Controllers.
- Views can be loaded from controller methods using the view() helper. Routes bind controller methods to URLs.
- Data can be passed from controllers to views using the with() method or an associative array. Data is accessed in views using Blade syntax.
- Blade syntax like if/else, loops, and includes can be used in views.
- Form data and URL parameters can pass data from
The document outlines procedures in Visual Basic, including sub procedures, function procedures, methods, argument promotion, value types vs. reference types, and passing arguments by value vs. reference. It provides examples of each type of procedure and discusses key concepts like scope, overloading, and recursion. Visual Basic procedures allow programmers to organize and structure their code into logical, reusable units.
The document provides an overview of MVC 4.0 and various MVC concepts and techniques including:
- Unit testing in MVC using interfaces to create loosely coupled components and mocking frameworks.
- Exception handling in MVC using the OnException method and HandleError attribute to catch exceptions.
- Routing in MVC using the default route and custom routes added to the route table.
- Navigation structures in MVC using the MVC Site Map Provider which allows specifying controllers and actions in site maps.
- Styling MVC applications using layouts to define common templates applied to views.
- Implementing AJAX in MVC to update individual sections of a page without reloading using
Overview of MVC Framework - by software outsourcing company indiaJignesh Aakoliya
This is an overview of MVC Framework for software development - by software outsourcing company India, iFour Technolab Pvt. Ltd. - http://www.ifourtechnolab.com
Similar a Murach : HOW to work with controllers and routing (20)
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxEduSkills OECD
Iván Bornacelly, Policy Analyst at the OECD Centre for Skills, OECD, presents at the webinar 'Tackling job market gaps with a skills-first approach' on 12 June 2024
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Diana Rendina
Librarians are leading the way in creating future-ready citizens – now we need to update our spaces to match. In this session, attendees will get inspiration for transforming their library spaces. You’ll learn how to survey students and patrons, create a focus group, and use design thinking to brainstorm ideas for your space. We’ll discuss budget friendly ways to change your space as well as how to find funding. No matter where you’re at, you’ll find ideas for reimagining your space in this session.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
2. How to use the default route……
This chapter begins by showing how to configure and use
the default route for an ASP.NET Core MVC app. When you
begin developing an app, it’s common to start with this
route.
ASP.NET Core 2.2 introduced a new approach to routing
known as end point routing. It’s generally considered a
best practice to use endpoint routing for all new
development . Before you can use endpoint routing, you
need to add the necessary MVC services to the app. Then,
you need to mark where the routing decisions are made
and configure the end points for each route a Startup .
How to configure the default route…..
3. cs file that configures the default route for an ASP
.NET Core MVC
app To do that, it uses a routing system known as endpoint routing
that was introduced in ASP
.
NET Core 2.2 and is recommended for development with ASP
.
NET Core 3.0 and late development with ASP
.NET Core 3.0 and later.
Before you can use endpoint routing, you need to add the necessary MVC
services to the app .
To do that, you can add one or more statements to the Configure Services()
method.
With ASP
.NET Core 3.0 and later, you can call the Add Controllers With Views
Prior to ASP
.NET Core 2.2, you had to use the Add Mvc() method to add
these services.
However, this included some services such as Razor pages that aren’t
typically necessary for an MVC app.
As a result, unless you need these services in your MVC app, it’s better to
use the Add Controllers With Views() method to add MVC services.
4. After you add the necessary services, you need to configure the routing. To
do that:
First, you call the
Use Routing()
method to mark
where the routing
decisions are
made
Then, you call
the Use
Endpoints()
method to
configure the
endpoints for
each route
can add any
services that you
want to run after
routing decisions
have been made
but before they
have been
executed. This
typically includes
the services for
5. The method for adding the MVC service
Two methods for enabling and configuring routing
6. Two methods in the Startup.cs file that configure the
default route:
// Use this method to add services to the project.
public void ConfigureServices(IServiceCollection services) {
services.AddControllersWithViews(); // add MVC services
//add other services here
}
// Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
app.UseDeveloperExceptionPage();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting(); // mark where routing decisions are made
// configure middleware that runs after routing decisions have been made
app.UseEndpoints(endpoints => // map the endpoints
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
// configure other middleware here
}
services.AddCont
}
7. Another way to map a controller to the default route ::
endpoints.MapDefaultControllerRoute()
<Description>
ASP
.NET Core 2.2 introduced a new approach to routing known as
endpoint routing. It’s generally considered a best practice to use endpoint
routing for all new development.
Before you can use endpoint routing, you need to add the necessary MVC
services to the app. Then, you need to mark where the routing decisions
are made and configure the
endpoints for each route.
8. A URL that has three segments:
The pattern for the default route:
{controller=Home}/{action=Index}/{id?}
How the default route works
The first segment specifies the controller. Since the pattern sets the Home
controller as the default controller, this segment is optional.
The second segment specifies the action method within the controller.
controller. Since the pattern sets the Index() method as the default action,
this segment is optional.
The third segment specifies an argument for the id parameter of the
action method.
The pattern uses a question mark (?) to specify that this segment is
optional
9. Description
The default route maps a request to an action method within a
controller and can optionally pass an argument to that action method
10. later segment, you must also supply values for the
earlier segments:
The table of request URLs shows how this works. Here, the first URL doesn’t
specify any of the three segments. As a result, the app routes the request to
the Index() method of the Home controller and it doesn’t pass an argument
to the id parameter of this method.
Later in the table, the seventh URL specifies all three segments. As a result,
the app routes the request to the List() method of the Product controller
and passes an argument of “Guitars” to the id parameter of this method.
This table assumes that the List() method defines the id parameter as a
string and doesn’t provide a default value for this parameter. As a result, if
the URL.
11. doesn’t specify a third segment for the List() method, it sets the id
parameter to null. Similarly, this table assumes that the Detail() method
defines the id parameter as an int and doesn’t provide a default value for
this parameter.
As a result, if the URL doesn’t specify a third segment for the Detail()
method, it sets the id parameter to the default int value of 0.
How the default route works:
Home
specifies the controller.
Since the pattern sets the
Home controller
as the default controller,
this segment is optional
Index
specifies the action
method within the
controller. Since the
pattern sets the Index()
method as the default
action, this segment is
optional.
Joel
specifies an argument for
the id parameter of the
action method.
The pattern uses a
question mark (?) to
specify that this segment
is optional
12. The Home controller:
using Microsoft.AspNetCore.Mvc;
namespace GuitarShop.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return Content("Home controller, Index action");
}
public IActionResult About()
{
return Content("Home controller, About action");
}
}
}
13. A browser after requesting the default page:
A browser after requesting the Home/About
page:
14. Description:
The class for an MVC controller typically inherits the Controller class from
Microsoft’s AspNetCore.Mvc namespace.
The action methods for a controller typically return an object that
implements the IActionResult interface such as a ContentResult or ViewResult
object.
To create a simple controller, you can begin by coding action methods that
use the Content() method to return ContentResult objects that contain plain
text.
To test a controller, you can run the app and enter a URL in the browser’s
address bar
15. How to code a controller named Product Controller that uses
the id segment of the default route. Here, the Product
controller begins much like the Home controller from the
previous figure.
However, both of its action methods provide a parameter
named id that maps to the id segment of the default route.
The List() method uses the string type for the id parameter
and provides a default value of “All”. • The Detail() method
uses the int type for the id parameter and does not provide a
default value.
16. The Product controller:
using Microsoft.AspNetCore.Mvc;
namespace GuitarShop.Controllers
{
public class Product Controller : Controller
{
public IActionResult List(string id = "All")
{
return Content("Product controller, List action, id: " + id);
}
public IActionResult Detail(int id)
{
return Content("Product controller, Detail action, id: " + id);
}
}
}
17. A browser after requesting the Product/List action with no id
segment
A browser after requesting the Product/Detail action with an id
segment
A browser after requesting the Product/Detail action with no id
segment
18. Description:
The List() method uses the string type for the id parameter and provides
a default value of “All”.
The Detail() method uses the int type for the id parameter and does not
provide a default value.
Now that you understand how the default route works, you’re ready to learn
how to create custom routes. One way to do that is to add static content to
a route.
How to create custom routes:
19. A pattern that mixes static and dynamic data for a segment:::
{controller}/{action}/{cat}/Page{num} // 4 segments
Example URLs:::
The List() method of the Product controller
public IActionResult List(string cat, int num)
{
return Content("Product controller, List action, " +
"Category " + cat + ", Page " + num);
}
20. A URL that requests Product/List action for page 1 of all
categories:::
A pattern that supplies one segment that’s completely static
{controller}/{action}/ {cat}/Page/{num} // 5 segment
Example URLs
A URL that requests Product/List action for page 1 of all
categories
21. Description::
To include static content as part of a segment, you
can use a string literal to provide the static part of
the segment and use braces to identify the dynamic
part of the segment.
To include a static segment, you can code a string
literal for the entire segment.
22. Code that maps three routing patterns to controllers
app.UseEndpoints(endpoints =>
{
// most specific route – 5 required segments
endpoints.MapControllerRoute(
name: "paging_and_sorting",
pattern: "{controller}/{action}/{id}/page{page}/sort-by-{sortby}");
// specific route – 4 required segments
endpoints.MapControllerRoute(
name: "paging",
pattern: "{controller}/{action}/{id}/page{page}");
// least specific route – 0 required segments
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
23. The List() method of the Product controller
public IActionResult List(string id = "All", int page = 1,
string sortby = "Price")
{
return Content("id=" + id + ", page=" + page + ", sortby=" + sortby);
}
Examples that use the default route:
24. Examples that uses the paging route::
Example URLs that use the paging_and_sorting
Route::
Description
When you map multiple routing patterns, you must code the most specific ones first and the
most general one last. If you code the most general pattern first, it will process all URLs
25. How to use attribute routing
So far, this chapter has shown how to use the Startup.cs file to specify
the routing patterns for an app. However, you can override this routing
by adding Route attributes to the action methods of a controller or to
the class for the controller. This is known as attribute routing.
Figure 6-7 starts by showing the class for the Home controller after attribute
routing has been applied to its Index() and About() actions. To change the
routing for the Index() action, this code places a Route attribute directly above
the Index() method and specifies a route of “/”. This maps the Index() action to a
URL that requests the root folder of the app. Similarly, this code places a Route
attribute directly above the About() method that maps the About() action to a
request URL of “About”.
How to change the routing for an action
26. The Home controller with attribute routing for
both actions:
public class HomeController : Controller
{
[Route("/")]
public IActionResult Index()
{
return Content("Home controller, Index action");
}
[Route("About")]
public IActionResult About()
{
return Content("Home controller, About action");
}
}
27. How request URLs map to controller classes and their action
methods:
Two default routes that are overridden by the
attribute routing::: /Home/Index
/Home/About
Two tokens you can use to insert variable data
into a route:
Description
To change the routing for an
action, you can code a Route
attribute directly above the
action method. Then, the
route specified by the
attribute overrides the route
that’s specified in the
Startup.cs file. This is known
as attribute routing.
To specify a static route, you
can code a string literal
within the Route attribute.
To insert the name of the
current controller or action
into a route, you can use the
[controller] or [action]
tokens.
28. The Product controller with attribute routing that
specifies segments:
public class ProductController : Controller
{
[Route("Products/{cat?}")]
public IActionResult List(string cat = "All")
{
return Content("Product controller, List action, Category: " + cat);
}
[Route("Product/{id}")]
public IActionResult Detail(int id)
{
return Content("Product controller, Detail action, ID: " + id);
}
[NonAction]
public string GetSlug(string name)
{
return name.Replace(' ', '-').ToLower();
}
}
29. How request URLs map to controller classes and
their action methods:
Two default routes that are overridden by the attribute routing
/Product/List
/Product/Detail
A more flexible way to code the attribute for the Product/List action
[Route("[controller]s/{cat?}")]
A more flexible way to code the attribute for the Product/Detail action
[Route("[controller]/{id}")
30. Description
To insert other segments into a route, you can use all of the skills for coding
coding segments such as the skills described earlier in this chapter.
If a controller contains methods that aren’t action methods, you can code the
NonAction attribute above it to prevent it from being mapped to a URL.
How to change the routing for a controller :::
In the last two figures, you learned how to use attribute routing to override the
routing for a single action in a controller. However, it’s also possible to use
attribute routing to override the routing for all actions within a controller. To do
that, you can code a Route attribute directly above the declaration for the
controller’s class as shown in figure 6-9.
31. The code for the Product controller::
[Route("Retail/[controller]/[action]/{id?}")]
public class Product Controller : Controller
{
public Iaction Result List(string id = "All")
{
return Content("Product controller, List action, Category: " + id);
}
public Iaction Result Detail(int id)
{
return Content("Product controller, Detail action, ID: " + id);
}
}
32. How request URLs map to controller classes and
their action methods
Two default routes that are overridden by the
attribute routing:
/Product/List /Product/Detail
Description
To change the
routing for all
actions in a
controller, you can
code a Route
attribute directly
above the
declaration for the
controller’s class.
33. Best practices for URLs :::
o Keep the URL as short as possible while still being descriptive and user-
friendly.
o Use keywords to describe the content of a page, not implementation
details.
o Make your URLs easy for humans to understand and type.
o Use hyphens to separate words, not other characters, especially spaces.
o Prefer names as identifiers over numbers.
o Create an intuitive hierarchy.
o Be consistent.
o Avoid the use of query string parameters if possibl.
34. A URL that identifies a product…
With a number
https://www.domain.com/product/1307
With a name
https://www.domain.com/product/fender-special-edition-standard-
stratocaster
With a number and name (to keep it descriptive but short)
https://www.domain.com/product/1307/fender-specia
35. Four URLs that use query strings to pass data (not
recommended)
https://www.murach.com/p/List?
/p/List?catId=1
/p/List?catId=1&pg=1
/p/Detail?id=1307
Four URLs that follow best practices
https://www.murach.com/product/list
/product/list/guitars
/product/list/guitars/page-1
/product/detail/1307/fender-stratocaster
Four URLs that follow best practices, but are even shorter
https://www.murach.com/products
/products/guitars
/products/guitars/page-1
/product/1307/fender-stratocaste
36. Description
Well-designed URLs can improve the usability of your app
for both developers and end users.
Well-designed URLs can improve the search engine
optimization (SEO) for your app.
A slug is a string that describes the content of a page. Using
a slug can make your URLs more user-friendly.
Using hyphens to separate words is known as kebab case.
37. How to work with areas:
An ASP
.NET Core MVC app can have multiple areas.
Each area can have its own controllers, models, and
views. This can help you organize the folders and files of
an app.
For example, you may want to create one area that
allows administrators to perform tasks such as adding
and updating the products that are stored in a database.
Then, you can use another area to allow customers to
browse through the products and add them to a cart.
38. How to set up areas ??
Figure 6-11 shows how to set up areas. By convention, you
can create an area by adding a folder named Areas to the root
folder for the app.
Then, within the Areas folder, you can add a folder for the area.
In this figure, for example, the folders and files for the Guitar
Shop appinclude an area named Admin.
Within the folder for the area, you can add the necessary
subfolders such as the Controllers, Models, Views, and so on.
39. The starting folders for a Guitar Shop app that
includes an Admin area…
GuritarShop
/Areas
/Admin
/Controllers
/HomeController.cs
/ProductController.cs
/Views
/Home
/Index.cshthml
/Product
/List.cshthml
/AddUpdate.cshthml
/Delete.cshthml
/Shared
/_AdminLayout.cshtml
_ViewImports.cshtml
_ViewStart.cshtml
41. Aroute in the Startup.cs file that works with an
area
app.UseEndpoints(endpoints =>
{
endpoints.MapAreaControllerRoute(
name: "admin",
areaName: "Admin",
pattern: "Admin/{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
Description::
An ASP
.NET Core MVC app can have multiple areas. Each area can have its own
controllers, models, and views. This can help you organize the folders and files of an app.
To configure the route for an area, you can use the MapAreaControllerRoute()
method to add a route that specifies the name of the area and its routing pattern
42. The Home controller for the Admin area ::
namespace Guitar Shop .Areas .Admin .Controllers
{
[Area("Admin")]
public class Home Controller : Controller
{
public IactionResult Index()
{
return View(); //map to/Areas/Admin/Views/Home/Index.cshtml
}
}
}
43. A token you can use to insert the area into a route ::
The Product conareatroller for the Admin ::
namespace Guitarshop .Areas . Admin . Controllers
{
[Area("Admin")]
public class Productcontroller : Controller
{
[Route("[area]/[controller]s/{id?}")]
public Iactionresult List(string id = "All") {...};
public IactionResult Add() {...};
public IactionResult Update(int id) {...};
public IactionResult Delete(int id) {...};
}
}
44. How reauest URLs map to controller classes and their action methods ::
Description
Before you can use a controller with an area, you must use the Area
attribute to associate it with an area.
After you add the Area attribute to the controller, you can use the [area]
token to specify attribute routing for the controller.
45. endpoint routing
URL path segment
default route
attribute routing
slug
kebab case
areas of an app
Terms:
46. Summary:
ASP
.NET Core 2.2 introduced a new approach to routing known as
endpoint routing. With ASP
.NET Core 3.0 and later, it’s generally
considered a best practice to use endpoint routing.
The path for a URL consists of zero or more segments where each
segment is separated by a slash (/).
The default route maps a request to an action method within a controller
and can optionally pass an argument to that action method.
Using the Route attribute to specify the routing for a controller or its
actions is known as attribute routing. Attribute routing overrides any
routing patterns specified in the Startup .cs file.
A slug is a string that describes the content of a page.
Using hyphens to separate words is known as kebab case.
An ASP
.NET Core MVC app can have multiple areas. Each area can
have its own controllers, models, and views
47. Exercise 6-1 Practice routing
View and test the default route for the app :
1- Open the Ch06Ex1RoutingPractice web app in the ex_ starts
directory.
2- Open the Startup .cs file and view its code. Note that it includes the
default route: {controller=Home}/{action=Index}/{id?} .
3- Open the Home Controller class in the Controllers folder and view its
code. Note that the Index() action method displays text that says “Home”
and the Privacy() action method displays text that says “Privacy”
48. 4- Run the app. This should start your browser and automatically call this
URL: https://localhost:5001 This should display text that says, “Home”.
5- Enter URLs in the browser to display the text returned by the Index() and
Privacy() methods. For example, try these URLs: https://localhost:5001/home
https://localhost:5001/home/privacy.
6- In the Home Controller class, view the code for the Display() action
method. Note that this method accepts a string parameter named id.
Review the code that works with this parameter.
49. 7- Run the app and test the Display() method by entering these URLs:
<https://localhost:5001/home/display>
<https://localhost:5001/home/display/123abc>
The first URL should display a message that indicates that the id hasn’t been supplied, and the
second URL should display a message that says, “ID: 123abc”
* Add an action method that uses the default route
8- In the Home Controller class, add the following action method. When you do, make sure to
declare a parameter of the int type with a name of id and a default value of 0 like this:
public Iaction Result Countdown(int id = 0)
{
string content String = "Counting down:n";
for(int i = id; i >= 0; i --)
{
content String += i+ "n";
}
return Content(content String);
}
50. 9- Run the app and enter a URL that calls the Countdown() method like this:
<https://ocalhost:5001/home/countdown >
This should display “Counting down:” followed by a 0 on the next line. That’s
because the URL omits the optional third segment of the default route. As a
result, the method uses the default value of 0 for the id parameter.
10- Run the app and enter a URL that calls the Countdown() method like this:
<https://localhost:5001/home/countdown/10 >
This should display a countdown that starts at 10 and counts down to 0 with
each integer on its own line. That’s because the URL included a value of 10
for the third segment.
51. Use attribute routing to customize the route for an action
method:
11- Add a Route attribute immediately above the Countdown() method like
this:
[Route("[action]/{id?}")]
public Iaction Result Countdown( int id = 0) {...}
12- Run the app and enter a URL that calls the Countdown() method like
this:
<https://localhost:5001/countdown/10>
Note that you only have to type the name of the action (countdown) and
the value of the id segment (10) in this URL, not the name of the controller
(home).
52. 13- In the Countdown() method, change the name of the parameter from id
to num. However, in the Route attribute, continue to use id as the name of
the second segment.
14- Run the app and test the Countdown() method without an id segment. It
should work correctly.
15- Test the Countdown() method with an id segment of 10 as before. This
should only display the default value of 0. That’s because the segment name
in the Route attribute must match the parameter name in the method.
16- In the Route attribute, change the second segment from {id?} to {num?}
17- Run the app and test the Count Down() method with a second segment
of 10. This should display a countdown from 10 to 0.
53. Add more segments to a route:
18- Edit the Route attribute for the Countdown() method like this:
[Route("[action]/{start}/{end?}/{message?}")]
public Iaction Result Countdown(int start, int end = 0,
string message = "")
Note that the segment names in the Route attribute match the parameter
parameter names in the action method and that the first two segments are
required but the third and fourth are optional.
54. 19- Modify the code for the Countdown() method so it starts counting down
at the start parameter, ends at the end parameter, and displays the message
param eter when the countdown is done.
20- Run the app and enter a URL that calls the Countdown() method like
this:
<https://localhost:5001/countdown/3/1/Liftoff!>
This should display a countdown like this:
Counting down:
3
2
1
Liftoff!
55. 21- Enter a URL that calls the Countdown() method like this:
<https://localhost:5001/countdown>
The browser should not be able to find the web page. That’s because the second
segment is now required. As a result, you must specify the start segment when you
enter this URL.
22- Enter a URL that calls the Countdown() method like this:
<https://localhost:5001/countdown/5 >
This should use the default parameters of the Countdown method to display a
countdown from 5 to 0 with no message