MVC Specification
MVC Specification
truYum
Version 0.1
Prepared By / Last
Reviewed By Approved By
Updated By
Selvam Ramadevanahalli
Name Seshadri M R Ramamoorthy/Abhinandan Lingachar,
Deka Shashidhara Murthy
Learning Solution Learning Solution Learning Solution
Role
Designer Architect Lead
Signature
Date
1.0 Introduction 3
1.1 Purpose of this document 3
1.2 Definitions & Acronyms 3
1.3 Project Overview 3
1.4 Scope 3
1.5 Hardware and Software Requirment 3
1.4 Scope
1. Creation of ASP.Net MVC web application for truYum application
2. Software Requirement
a. IE or Chrome
1. Application user launches the application. There should be a link to View the Menu items as
the Admin of the application.
3. Use Entity Framework to get the data of the relevant entities and display it in the View.
5. On any exception, user should be directed to “Error” view with a message Exception
occurred in [Action] method of [controller]. Along with this, please append the
exception message.
Create the MenuItem model with the required fields and data annotations
Use data annotation Required for the Name & Price fields. This data annotation
will show the default message on the UI while creating a MenuItem.
Use data annotation Display with name attribute for the fields, FreeDelivery and
DateOfLaunch. This will ensure that the detail listed on the UI will be appropriate.
Use the data annotation DataType as Date for DateOfLaunch. This will help to
display the date field in the format that is expected.
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}",
ApplyFormatInEditMode = true)]
Reference the CategoryId and the Category class reference as Foreign key in the
MenuItem class
Create the Cart model with the required fields and data annotations. Create a reference
to the MenuItem class to create foreignkey reference
Create a class TruYumContext in the Models folder. Inherit it from DbContext class of
the namespace System.Data.Entity
Add DbSets for MenuItems, Carts and Categories in the TruYumContext class
The “OnModelCreating” method override ensures that the table that gets created
thru the CodeFirst approach has a singular name. On
o Enabling migration
o Add migration
o Update database
o Main Course
o Starters
o Snack
Modify the RouteConfig for the Default route to point to the MenuItems controller
o In the ActionLink for Menu Item for Admin “Menu Item – Admin”, send an object with
a parameter “isAdmin” whose value should be True, to be output as querystring
parameter. This will NOT be required for Customer role
Create MenuItemsController thru EntityFramework scaffolding. Use the Index action method
to list the Menu items
o Create a boolean parameter “isAdmin” to the Index method and set the default value
to false. This would be used to filter the menu item listing for Admin and Customer
The “Create New” link in the menu item list page should be used to Create a new Menu Item
by the admin user.
1. Application user launches the application. There should be a link to View the Menu items as
the Customer of the application.
2. Customer user would be able to view the Active menu items and whose date of launch is in
3. On any exception, user should be directed to “Error” view with a message Exception
occurred in [Action] method of [controller]. Along with this, please append the
exception message.
Modify the Index Action method of MenuItemsController to filter the Menu items as per the
requirement
Modify the Index view to access the ViewBag to choose the columns to be listed
2. Admin user clicks on Edit link against every line item in the Menu items list. On click the edit
page loads
3. The menu item Id should be sent to the Edit Action method of the MenuItemsController
6. On any exception, user should be directed to “Error” view with a message Exception
occurred in [Action] method of [controller]. Along with this, please append the
exception message.
The “Back to List” hyperlink should navigate to the MenuItem listing page. The role of the user
should be set while redirecting to Menu item list.
5.1 Requirement
Steps Explanation
1. Customer clicks on “Add to Cart” link on a menu item from Menu Item List.
3. The menu item should be added to the Cart table for the customer
4. On any exception, user should be directed to “Error” view with a message Exception
occurred in [Action] method of [controller]. Along with this, please append the
exception message.
On adding an item to cart, redirect the user to View the items in cart
6.1 Requirement
Steps Explanation
4. Get all the cart items of the user and show the menu item detail
5. If there are no cart items, then display a message and a link to View menu items to add to
cart. This should direct the Customer to the Menu item list with a link to add the item to cart.
6. On any exception, user should be directed to “Error” view with a message Exception
occurred in [Action] method of [controller]. Along with this, please append the
exception message.
Create Index action method to Get the cart items for the user whose Id is 1, a hardcoded
value
Use Entity Framework’s Include feature to get the MenuItem detail, to get its data included
with Cart detail
Create a View for the menu item detail listing. Have link in each row to “Remove” item
from cart. Bind the cart id to the link
Use MVC Razor syntax in the View to check if the bound model contain data or not. If
there is no data display textual content stating “There are no items in your cart.” Provide
a link “View Menu Items” aiding the customer to navigate to Menu items page. This page
has a link to add the item to cart.
7.1 Requirement
Steps Explanation
1. Customer clicks on “Remove” link on menu item in the Cart listed thru /Cart or
/Cart/Index.
Delete the item and Save changes for the action to be updated in the database
4. There should not be any hard coded values in code. It has to be referenced from
Web.config file