Answered step by step
Verified Expert Solution
Question
1 Approved Answer
N 7 = 6) Closely review the C# WebAPI code given below and find all the errors in the code. You must clearly mention error
N 7 = 6) Closely review the C# WebAPI code given below and find all the errors in the code. You must clearly mention error line number, error detail and correct code to fix each error. 1 namespace WebAPIDemo.Controllers{ 2 public class EmployeesController : WebApiController{ 3 Employee [] employees = new Employee[] { 4 new Employee { ID = 1, Name = "Mark", JoiningDate = 5 DateTime.Parse(DateTime. Today.ToString()), Age = 30 }, 6 new Employee { ID = 2, Name = "Allan", JoiningDate = DateTime.Parse(DateTime. Today.ToString(), Age = 35 }, 8 new Employee { ID = 3, Name = "Johny", JoiningDate = 9 DateTime. Parsing (DateTime. Today.ToString()), Age = 21 } 10 }; 11 12 public IEnumerable (Employee) GetAllEmployees () { return employees; 14 } 15 16 public IHttpActionResponse Get Employee(int id) { 17 var employee = employees. FirstAndDefault((p) => p.ID == id); 18 if (employee == null) { 19 return NotFound(); 20 } return Okay(employee); 22 } 23 } 24 } 13 = 21
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started