asp.net-core

How to dynamically add to list with ViewModel in ASP.NET Core 3.1 MVC with JavaScript and C#

喜夏-厌秋 提交于 2021-02-11 17:10:16
问题 I am trying to dynamically add to a list property in my ViewModel using JavaScript. Whenever I submit my form, there are no items in the list in the post controller. I have tried to add to the list inside the JavaScript function using razor syntax like so: @{ Model.Contacts.Add(new Contact { ID = 1, FirstName = "Tester" }) } Just to see if I could even get a item in the list. I've also done it at the top of the page to see if it was just because it was in JavaScript. However when I submitted

How to dynamically add to list with ViewModel in ASP.NET Core 3.1 MVC with JavaScript and C#

十年热恋 提交于 2021-02-11 17:08:58
问题 I am trying to dynamically add to a list property in my ViewModel using JavaScript. Whenever I submit my form, there are no items in the list in the post controller. I have tried to add to the list inside the JavaScript function using razor syntax like so: @{ Model.Contacts.Add(new Contact { ID = 1, FirstName = "Tester" }) } Just to see if I could even get a item in the list. I've also done it at the top of the page to see if it was just because it was in JavaScript. However when I submitted

How to dynamically add to list with ViewModel in ASP.NET Core 3.1 MVC with JavaScript and C#

不问归期 提交于 2021-02-11 17:04:20
问题 I am trying to dynamically add to a list property in my ViewModel using JavaScript. Whenever I submit my form, there are no items in the list in the post controller. I have tried to add to the list inside the JavaScript function using razor syntax like so: @{ Model.Contacts.Add(new Contact { ID = 1, FirstName = "Tester" }) } Just to see if I could even get a item in the list. I've also done it at the top of the page to see if it was just because it was in JavaScript. However when I submitted

Controller Query Parameter (not in action)

怎甘沉沦 提交于 2021-02-11 17:01:22
问题 I'm trying to make a api like the OPENBANKPROJECT. Such as /api/banks/{BANK_ID}/atms/{ATM_ID} etc. I guess banks and atm is a different controller I want get a global ( api/Claim/{id}/Detail/[action] i need this {id}) parameter before before [action] initialize (maybe in constructor). How do i get this {id} before [action] initialize? [Route("api/Claim/{id}/Detail/[action]")] public class ClaimDetailController { int _id; // assignment {id} public ClaimDetailController(IClaimDetailService

Google Calendar Api v3 quota exceeded

牧云@^-^@ 提交于 2021-02-11 16:59:47
问题 I'm having a problem with creating calendar events ( With a google service account ), I have the Domain-wide Delegation enabled. The error i'm getting is: "Message[Calendar usage limits exceeded.] Location[ - ] Reason[quotaExceeded] Domain[usageLimits]" I've checked the usage and its below 10 requests ( The quota is set to 1,000,000 ) This is my code: string[] Scopes = { CalendarService.Scope.Calendar, CalendarService.Scope.CalendarEvents }; using (var stream = new FileStream("cred.json",

When methods have the name …Async the exception “System.InvalidOperationException: No route matches the supplied values” occurs

核能气质少年 提交于 2021-02-11 15:40:43
问题 Steps to reproduce: Create a new Web API project Create a UsersController with the following code . [ApiController] [Route("[controller]")] public class UsersController : ControllerBase { [HttpGet("{id:int}", Name = nameof(GetUserByIdAsync))] public async Task<ActionResult<object>> GetUserByIdAsync([FromRoute] int id) { object user = null; return Ok(user); } [HttpPost] public async Task<ActionResult<object>> CreateUserAsync() { object user = null; return CreatedAtAction(nameof

NonFactors.Grid.Mvc6 click not fires

拥有回忆 提交于 2021-02-11 15:30:15
问题 I am attempting to implement paging in my simple ASP.NET Core 2.2 application. I executed the command Install-Package NonFactors.Grid.Mvc6 to install the package and followed all the installation steps described in this page. I can see the data displayed in grid but when I click to show the next records the paging in not moving to show the other records. I am missing any scripts? 回答1: I made the test followed the tutorial that you provided , but it worked well. Make sure your styles and

Certificate validation failed: validation of client side certificate fails when the certificate is validated

℡╲_俬逩灬. 提交于 2021-02-11 15:24:09
问题 I am trying to get mutual client certification to work in Azure. I am running a web app with this configuration: public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services .AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme

Certificate validation failed: validation of client side certificate fails when the certificate is validated

被刻印的时光 ゝ 提交于 2021-02-11 15:22:36
问题 I am trying to get mutual client certification to work in Azure. I am running a web app with this configuration: public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services .AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme

How to redirect .ASPX pages to .NET Core Razor page

ぃ、小莉子 提交于 2021-02-11 14:57:32
问题 We are moving a big asp.net web site to .NET Core Razor pages site. All over the internet there are links that point to our site and we want those links to work after our migration. We will kept the same url format, but without the extension .aspx. Summary, we want our old url: example.com/item.aspx be handle by .net core razor page, as example.com/item 回答1: You could use the URL Rewriting Middleware to remove the ".aspx" extensions. Check the following code: Use AddRedirect to create a rule