Categories
Mastering Development

ASP.NET Core how to pass List

In ASP.NET Core, I have searched around but cannot figure out how to pass a list from the view to controller. I can create a form and pass a single int value, but not a List<int>.Here is what I have to pass a single value <form id="myForm"> <div class="modal-body"> <div class="form-group"> <label class="custom-label"> <div class="col-sm-3"> […]

Categories
Mastering Development

ASP.NET Core how to randomly set property value

In ASP.NET Core, I need to set a property to a random string, but the random string will be generated from another property. The properties are public class State { public int Id {get;set;} public string Name {get;set;} public string Capital {get;set;} public string RandomCapital {get;set;} } Basically Capital has values state capitals as its […]

Categories
Development

How to get class reference from string?

In ASP.Net Core, I can get a list of all my entities, and find a specific one by name: var entities = _context.Model.GetEntityTypes(); var entity = (from e in entities where e.Name == $”MyNamespace.Models.{entityname}” select e).FirstOrDefault(); Console.WriteLine(entity.Name); //example output: MyNamespace.Models.Car So I can access the entity name (or Model name) as a string, and now […]

Categories
Development

Cant add class or interface in project. VS 2019

In asp.net core, the project at some point lost the ability to add classes or something else to the project or any of its folders, writes – “please choose a project type”. In other projects, such an opportunity is remained. I have a last ver. VS 2019 on this moment. The output of dotnet –list-sdks […]

Categories
ASP.NET Development

Asp.net core uiculture multiple threads

In asp.net core, if i set the ui culture of a thread when user x calls my web service, can it cause other users to have their ui culture change? Explanation: i read that a single thread can be used for multiple requests. is that true and if so how what happens when i change […]