Question

Build a project with using C# and MVC The site can have any content/theme that you...

Build a project with using C# and MVC

The site can have any content/theme that you want (be creative). The only requirements are as follows:

1) The site should have at least 2 different routes (for example: home and about routes/pages)

Homework Answers

Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Here a new Asp.net MVC web application in C# is created using Visual Studio 2017 with name "TechNewsWebApplication".This application contains below details.

NOTE :Images are used for demonstration purpose only.

Solution Explorer :

HomeController.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace TechNewsWebApplication.Controllers
{
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
}
}

******************************

Index.cshtml :


@{
ViewBag.Title = "TechNews";
}

<img src="~/Images/apple.png" />
<h1>Apple will launch Iphone 11 and IOS 13 on 10th sep 2019.</h1>
<hr /><hr />
<img src="~/Images/oneplus.jpg"/>
<h1>Oneplus 7T will be launched in 05th Oct 2019 in India</h1>
<hr /><hr />
<img src="~/Images/amazon.png" />
<h1>Amazon has announced great indian dewali sell.</h1>
<hr /><hr />

*******************************

_Layout.cshtml :

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - TechNews Pvt Ltd.</title>
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="~/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("TechNews Pvt Ltd.", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })

</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
@Html.ActionLink("Registration", "Register", "Registration", new { area = "" }, new { @class = "navbar-brand" })
</li>
</ul>
</div>
</div>
</div>

<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>&copy; @DateTime.Now.Year - TechNews Pvt Ltd.</p>
</footer>
</div>

<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
</body>
</html>

******************************

site.css :

body {
padding-top: 50px;
padding-bottom: 20px;
}

/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}

/* Set width on the form input elements since they're 100% wide by default */
input[type='text'],input[type='email'],
select{
height: 60px;
width: 300px;
font-size: 22px;
padding: 20px;
margin: 10px;
}
/*style for h1*/
h1{
display:inline;
}
/*style for image*/
img{
height:150px;
width:150px;
padding:10px;
border:2px solid green;
}
/*style for button*/
input[type='submit'], input[type='reset'] {
background-color: lightgreen;
color: maroon;
margin: 10px;
width: 150px;
height: 60px;
}
*****************************

RegistrationController.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace TechNewsWebApplication.Controllers
{
public class RegistrationController : Controller
{
// GET: Registration
public ActionResult Register()
{
return View();
}
}
}

******************************

Register.cshtml :


@{
ViewBag.Title = "Register";
}
<br />
<h1>Register for Event</h1>
<table>
<tr>
<td>Name</td>
<td>
<input type="text" id="txtName" placeholder="Enter Name" />
</td>
</tr>
<tr>
<td>Email</td>
<td>
<input type="email" id="txtEmail" placeholder="Enter Email" />
</td>
</tr>
<tr>
<td>Select Event</td>
<td>
<select>
<option>Apple 11 launch</option>
<option>Oneplus 7T launch</option>
<option>Amazon Sell</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>
  
</td>
<td>
<input type="submit" />
<input type="reset" />
</td>
</tr>
</table>
******************************

RouteConfig.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace TechNewsWebApplication
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :Index.cshtml

Screen 2 :Register.cshtml

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1. You are asked to build a new hospital: This will be an elderly hospital. And...
1. You are asked to build a new hospital: This will be an elderly hospital. And It will be a digital hospital, which will use all technological facilities. This assignment will be prepared in 2 parts. a) FİRST PART: Remember all the topics you learned in this lesson. Plan the technological applications that should be in the digital hospital you will build using this knowledges.( Information: This section will be at least “2” pages.) b) SECOND PART: Using your creativity...
Project 6-Printing a Formatted Report Printing a formatted report from the DDI.LEDGER_VIEW USING Head of Forms,...
Project 6-Printing a Formatted Report Printing a formatted report from the DDI.LEDGER_VIEW USING Head of Forms, Form Breaks, and an End of Form 70. Requirements: Build a report using the ledger view I would like you use at least 4 techniques you have learned in this course such as Any Report formatting techniques Any Data formatting techniques Any Error handling techniques Any OOP techniques such as data types. Any Cursor techniques USING Head of Forms, Form Breaks <- are not...
Company X want to Invest to project A, B or C (the company can only invest...
Company X want to Invest to project A, B or C (the company can only invest in one project (A, B or C) or the company can choose not invest to any project (DN (do nothing)). Based on the incremental analysis rates of return shown below, what alternative should company X choose (MARR = 10%)? Comparison IRR A - DN -3% B - DN -2% C - DN 8% B - A 12% C - B 15% C - A...
2. Get ready Read the following details for a project to expand the Quest Web site...
2. Get ready Read the following details for a project to expand the Quest Web site to offer business travel services. Expanding the Quest Web site to provide business travel services: Ron Dawson can design the Web pages. He estimates he needs about 5 hours and $250 to do this. The Web pages should be designed June 1-5. Overall budget is $2000. The tour database also needs to be expanded. Keisha Lane is in charge of this task. She needs...
(Use the case of “Global Treps”) You have been selected as the project manager for the...
(Use the case of “Global Treps”) You have been selected as the project manager for the Global Treps project. You helped to run a local shark tank like event at your college last year as part of a class project, so you have a general idea of what is involved. The schedule goal is six months, and the budget is $120,000. Your favorite professor, Dr. K., and a few of her associates have agreed to fund the project. Your strengths...
The magic and excitement of theme parks have enthralled Rabea since her first visit to the...
The magic and excitement of theme parks have enthralled Rabea since her first visit to the Ferrari theme park in Abu Dhabi, a few years ago. The characters, the enchanted atmosphere, the immaculate park grounds, and the stories told by the Ferrari theme park employees – all of this made such a memorable impression that Rabea would now like to use a theme park as the focus for her Masters’ research project at Al Ain University. Her interest in the...
Subject:Child development in early childhood ecucation but I choose physology to be easy but I really...
Subject:Child development in early childhood ecucation but I choose physology to be easy but I really need this answer As soon As possible.: As early childhood educators plan developmentally appropriate curriculum and instruction for their students they must also find ways to communicate what the children are learning to parents and families. This can be done through newsletters, curriculum nights, bulletin board displays or short notes home with information about an upcoming unit or curriculum theme. Write a short memo...
please I want you to answer this question and most importantly, the answer is not already...
please I want you to answer this question and most importantly, the answer is not already available on this site or other site Course Learning Outcome: Apply Organizational behavior knowledge and skills to manage diversified culture in the organizational settings (Lo 2.2). Essay: Differences in Culture and Diversity at workplace Essay Write an essay about the differences in Culture and Diversity at workplace. Use examples, peer-reviewed journals to support your answer. This essay must be at least 1000-word in length....
You are evaluating a project for The Tiff-any golf club, guaranteed to correct that nasty slice....
You are evaluating a project for The Tiff-any golf club, guaranteed to correct that nasty slice. You estimate the sales price of The Tiff-any to be $430 per unit and sales volume to be 1,000 units in year 1; 1,500 units in year 2; and 1,325 units in year 3. The project has a 3-year life. Variable costs amount to $240 per unit and fixed costs are $100,000 per year. The project requires an initial investment of $174,000 in assets,...
● Write code to read the content of the text file input.txt using JAVA. For each...
● Write code to read the content of the text file input.txt using JAVA. For each line in input.txt, write a new line in the new text file output.txt that computes the answer to some operation on a list of numbers. ● If the input.txt has the following: Min: 1,2,3,5,6 Max: 1,2,3,5,6 Avg: 1,2,3,5,6 Your program should generate output.txt as follows: The min of [1, 2, 3, 5, 6] is 1. The max of [1, 2, 3, 5, 6] is...