web site creation
Budget: $10 – $30 CAD
You’re working on a web site for fertilizer test plots, currently doing edits on the farm table.
Your initial project and database are shared via an eConestoga. Only what is uploaded to “Final Exam - Dropbox” (under Assignments) will be marked. You are responsible for uploading the project to dropbox.
Create the OEC database from the SQL script. The models, context, and Session support have already been added to the project.
In _layout.cshtml:
Add a menu entries for the Farm, Province and Country controllers
Display the TempData variable “message” before the guest page, in bold & red.
Put your name and section in the footer.
Generate the Country controller with full CRUD support for the country table.
Generate the Province controller with full CRUD support for the province table.
Generate the Farm controller with full CRUD support for the farm table.
In the Create view replace the provinceCode drop-down with a textbox to test your edits and add a span tag to display field-validation errors for it.
Use a try-catch in all actions that modify database tables:
If the action succeeds, display a message to that effect on the Index page
If not, re-display the user’s input and the innermost exception’s message, if one was thrown.
On all views, modify the asp-validation-for span elements to display field errors.
Farm edits must be performed through the model except for Remote & custom annotation code:
Do not apply edits or annotations directly to the generated model or to controller actions.
Use a metadata class to apply them to the model through a like-named partial class.
[ModelMetadatType(typeof(xxx))] might be helpful.
Add the following to the top of the partial class, to give it access to the database tables:
OECContext _context = new OECContext();
All strings are to be trimmed of leading/trailing blanks.
A non-blank farm name is required
Either the town or the county (not country) must be provided. Having both is fine, but is not mandatory.
The provinceCode is required, and must be exactly 2 letters.
Accept upper or lower case, but shift to upper case before writing to the database.
It must be validated against the province table.
The postalCode is required, though it could be a US zip code or another pattern, if we go to more countries.
Use the postalPattern from the proper country record to obtain the correct regular expression to apply. Accept upper or lower case for patterns that use letters.
Shift postalCode to upper case before writing to the database.
Phone numbers are optional but, if provided, they must contain a phone number in the dash notation 123-123-1234. This could buried in extraneous information like “you can reach me through my neighbour bob” … this stuff should be retained as well.
The test centre cannot contact a farmer before they have signed on to the program so:
The dateJoined and lastContactDate are optional (can be null) but, when they have a value, it must be a valid date and not be in the future.
If lastContactDate is provided, dateJoined must also be provided and lastContactDate cannot be before dateJoined.
The lastContactDate can be null when dateJoined is provided.
Your initial project and database are shared via an eConestoga. Only what is uploaded to “Final Exam - Dropbox” (under Assignments) will be marked. You are responsible for uploading the project to dropbox.
Create the OEC database from the SQL script. The models, context, and Session support have already been added to the project.
In _layout.cshtml:
Add a menu entries for the Farm, Province and Country controllers
Display the TempData variable “message” before the guest page, in bold & red.
Put your name and section in the footer.
Generate the Country controller with full CRUD support for the country table.
Generate the Province controller with full CRUD support for the province table.
Generate the Farm controller with full CRUD support for the farm table.
In the Create view replace the provinceCode drop-down with a textbox to test your edits and add a span tag to display field-validation errors for it.
Use a try-catch in all actions that modify database tables:
If the action succeeds, display a message to that effect on the Index page
If not, re-display the user’s input and the innermost exception’s message, if one was thrown.
On all views, modify the asp-validation-for span elements to display field errors.
Farm edits must be performed through the model except for Remote & custom annotation code:
Do not apply edits or annotations directly to the generated model or to controller actions.
Use a metadata class to apply them to the model through a like-named partial class.
[ModelMetadatType(typeof(xxx))] might be helpful.
Add the following to the top of the partial class, to give it access to the database tables:
OECContext _context = new OECContext();
All strings are to be trimmed of leading/trailing blanks.
A non-blank farm name is required
Either the town or the county (not country) must be provided. Having both is fine, but is not mandatory.
The provinceCode is required, and must be exactly 2 letters.
Accept upper or lower case, but shift to upper case before writing to the database.
It must be validated against the province table.
The postalCode is required, though it could be a US zip code or another pattern, if we go to more countries.
Use the postalPattern from the proper country record to obtain the correct regular expression to apply. Accept upper or lower case for patterns that use letters.
Shift postalCode to upper case before writing to the database.
Phone numbers are optional but, if provided, they must contain a phone number in the dash notation 123-123-1234. This could buried in extraneous information like “you can reach me through my neighbour bob” … this stuff should be retained as well.
The test centre cannot contact a farmer before they have signed on to the program so:
The dateJoined and lastContactDate are optional (can be null) but, when they have a value, it must be a valid date and not be in the future.
If lastContactDate is provided, dateJoined must also be provided and lastContactDate cannot be before dateJoined.
The lastContactDate can be null when dateJoined is provided.
Related categories:
ASP.NET