6
Answers

How to read CSV file !

Abdalla Omran

Abdalla Omran

5y
1.1k
1
Hi there
i would like to read the CSV file holding some data about temp for example i would like to read the data actual mean temp, actual min temp and so on but the problem i am faceing that the data is not clear i can not read it well here an Example :
date,actual_mean_temp,actual_min_temp,actual_max_temp,average_min_temp,average_max_temp,record_min_temp,record_max_temp
2014-7-1,76,66,86,66,85,48,97,1885,1970,0.13,0.16,5.09
2014-7-2,71,63,79,66,85,50,99,1904,1970,0.00,0.16,4.50
2014-7-3,67,60,73,66,85,49,100,1968,1911,0.0,0.15,1.89
if i open it as txt its the same problem thus the Question if i can read it like this or spilting with comma ?
for any idea i will be so happy
thanks
 
Answers (6)
3
Anupam Maiti

Anupam Maiti

180 10.7k 3.5m Oct 05

In ASP.NET Core MVC, when you create an Area, it organizes controllers separately. That’s why you can’t use root-level controllers inside an Area. To access both, you need to set up separate routes—one for the Area and another for the root controllers—to make them work together.

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapControllerRoute(
    name: "areas",
    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");

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

app.Run();

Accepted
2
Jayraj Chhaya

Jayraj Chhaya

303 6k 92.9k Oct 04

In ASP.NET Core MVC, areas are designed to help organize your application into smaller, manageable sections, particularly for larger applications. When you create an area, it introduces a new routing convention that isolates the controllers and views within that area.

This means that when you define an area, the routing system looks for controllers specifically within that area folder. For example, if you have an area named "Admin," the routing will prioritize controllers located in Areas/Admin/Controllers. As a result, controllers in the root directory are not directly accessible unless you explicitly define routes for them.

To access controllers in the root directory while using areas, you can define custom routes in your Startup.cs file. 

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

    endpoints.MapAreaControllerRoute(
        name: "admin",
        areaName: "Admin",
        pattern: "Admin/{controller=Dashboard}/{action=Index}/{id?}");
});

This setup allows you to maintain both area-specific and root-level controllers effectively.

1
mina shaker

mina shaker

1.1k 233 11k Oct 08

@Anupam Maiti  should i include the `{area:exists}` in the main class or this is a placeholder for somthing