Question: I am having problems with the method of the controller using Microsoft.AspNetCore.MVC using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Dropbox2A.Controllers {

I am having problems with the method of the controller

using Microsoft.AspNetCore.MVC

using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks;

namespace Dropbox2A.Controllers { public class EmployeeController : Controller { //GET: // public IActionResult Index() { return View(); } public string PayAmount (string name, int rate, int hours) { PayAmount = (char)(rate * hours);

return $"{name}'s pay amount is {PayAmount}"; } } } I am having problems with the method of the controller using Microsoft.AspNetCore.MVC

Startup.cs

using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc;

namespace Dropbox2A { public class Startup { // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddMvc(); }

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); }

app.UseRouting();

app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); } } }

When the user enters the following URL

https://localhost:44335/Employee/PayAmount?name=Lynn&rate=25&hours=12

using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Dropbox2A.Controllers

{ public class EmployeeController : Controller { //GET: // public IActionResult Index()

- 0 1 X Cartup.cs Dropbox2A EmployeeController.cs* + x Dropbox2A: Overview Dropbox2A.Controllers. EmployeeController Solution Explorer www.www.www. PayAmount(string name, int rate, int hours) 8 { 9 10 11 12 13 O references public class EmployeeController : Controller { //GET: / EmployeeController > T appsettings.json > C# Program.cs c# Startup.cs 14 15 16 17 18 19 20 return $"{name}'s pay amount is {PayAmount}"; } 21 22 23 24 } Properties IX CEIP d. DELIVERY Programming Challenge 2.2 Continue to work on Programming Challenge 2.1. When the user enters localhost/Employee/Pay Amount?name=Lynn&rate=25&hours=12 The browser should show "Lynn's pay amount is $300.00." as shown in amount depends on the rate and hours values in the URL. http:/localhost 57276/Employee/PayAmount?name=Lynn&rate=3 Lynn's pay amount is $300.00. Figure 2.20 Programming Challenge 2.2 Browser Output. 42 following Memming Challenge 2.1. When the user enters the Portmountimame=Lynn&rate=25&hours=12 show Inns pay amount is $300.00." as shown in Figure L.A. Enter Sub an die nae and hours values in the URL. ter the s kozares1276/Employe/PayAmount?name=Lynn&rate=25&hours=12 mount is $300.00. Ent En ming Challenge 2.2 Browser Output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!