asp.net-core-mvc

ASP.NET Core MVC Ajax not working properly

牧云@^-^@ 提交于 2021-01-05 07:19:09
问题 My issue is very very simple but I have not found any solution about this issue in the entire internet. I am new at ASP.NET CORE MVC and I feel its AJAXs is very hard to understand compared to the normal ASP.NET. Well I am trying to pass an array/list of objects to controller but I cant make this. It is Very simple but it does not work the way I want ( In the normal ASP.NET MVC worked great). For example I have this: var detalleVenta = new Array(); $.each($("#tableventa tbody tr"), function (

.NET Core 3.1 CreateHostBuilder Cannot parse JSON file

∥☆過路亽.° 提交于 2021-01-05 06:00:05
问题 I am experiencing an error when trying to run my ASP.Net Core 3.1 project. The error is at CreateHostBuilder within Program.cs public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }); } which has not been edited from the default ASP.NET Core Web application template from

.NET Core 3.1 CreateHostBuilder Cannot parse JSON file

徘徊边缘 提交于 2021-01-05 05:59:18
问题 I am experiencing an error when trying to run my ASP.Net Core 3.1 project. The error is at CreateHostBuilder within Program.cs public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }); } which has not been edited from the default ASP.NET Core Web application template from

Using ASP.NET Core's ConfigurationBuilder in a Test Project

久未见 提交于 2020-12-29 05:29:45
问题 I want to use the IHostingEnvironment and ConfigurationBuilder in my functional test project, so that depending on the environment the functional tests run using a different set of configuration. I want to make use of the code below: public IConfigurationRoot ConfigureConfiguration(IHostingEnvironment hostingEnvironment) { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{hostingEnvironment.EnvironmentName}.json", true)

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

人走茶凉 提交于 2020-12-24 07:12:08
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

南笙酒味 提交于 2020-12-24 07:11:17
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

余生长醉 提交于 2020-12-24 07:06:45
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

…衆ロ難τιáo~ 提交于 2020-12-24 07:06:39
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

Unable to resolve service for type while attempting to activate

元气小坏坏 提交于 2020-12-19 07:17:48
问题 I have one file Repository.cs that contains an interface and its implementation like so: public interface IRepository { IEnumerable<City> Cities { get; } void AddCity(City newCity); } public class MemoryRepository : IRepository { private List<City> cities = new List<City> { new City { Name = "London", Country = "UK", Population = 8539000}, new City { Name = "New York", Country = "USA", Population = 8406000 }, new City { Name = "San Jose", Country = "USA", Population = 998537 }, new City {

Unable to resolve service for type while attempting to activate

一曲冷凌霜 提交于 2020-12-19 07:10:26
问题 I have one file Repository.cs that contains an interface and its implementation like so: public interface IRepository { IEnumerable<City> Cities { get; } void AddCity(City newCity); } public class MemoryRepository : IRepository { private List<City> cities = new List<City> { new City { Name = "London", Country = "UK", Population = 8539000}, new City { Name = "New York", Country = "USA", Population = 8406000 }, new City { Name = "San Jose", Country = "USA", Population = 998537 }, new City {