Can't update Database with EF Code-First

I am using EF code-first migrations. I added a new property to my model but it doesn't reflect as a column in the database. Configuration.cs public Configuration() { AutomaticMigrationsEnabled = true; } Global.asax.cs Database.SetInitializer...
more »

2017-03-19 08:03 (3) Answers

Display IEnumerable<dynamic> in a view

I have a model as shown below. The MenuItem model, which has different SQL queries (MenuItem.MenuSQLQuery). I am executing these query agaist a progress DB and I want to display the result on the view. The return of the SQL query is IEnumerable dyna...
more »

2017-03-19 02:03 (2) Answers

How to customize Url in asp.net mvc

I want to customize URL for my asp.net mvc application. Currently I am working on asp.net MVC 4.5 Case : 1 Current URL : localhost/Country/Index/param1 Expected URL : localhost/param1 Case : 2 Current URL : (1) localhost/Country/Index/p...
more »

2017-03-18 05:03 (1) Answers

Remove column from AspNetUsers

I created a database context. I would like remove some columns in tables AspNetUsers e.g. PhoneNumber, PhoneNumberConfirmed because it isn't necessary in my application. namespace TestTest.Infrastuctures { public class TestContext:IdentityDbCon...
more »

2017-03-17 00:03 (2) Answers

DELETE statement conflicted (ASP.NET MVC)

I have ASP.NET MVC app I have two relative tables Companies and Vacancies. When I delete Company, I want to delete relative to it Vacancies. Here is my controller public ActionResult Delete(int? id) { if (id == null) { ...
more »

2017-03-16 21:03 (1) Answers

Cannot map LINQ to Entities

I'm not very clear with writing linq queries. I write a query to select only certain columns from a table using linq lambda expression and I get the error that linq cannot be constructed to entities. The same query when I write using linq to select a...
more »

2017-03-16 15:03 (2) Answers

Access all available ViewComponents as a list

I would like to search through a list of all available ViewComponents in a asp.net core MVC (mvc6?) project, something like this. Default.cshtml for ViewComponent foreach (var section in Model.sections) { var sectionId = section.Id; if (_s...
more »

2017-03-16 13:03 (1) Answers

ASP.NET Core - Download .exe returns 404 error

I have a ASP.NET core MVC application and in the wwwroot folder, I've added another folder called "Shaun" and in that folder I've dropped an exe to try and download: Now if I navigate to: http://localhost:PORT/Shaun/chromesetup.exe I get a 404 err...
more »

2017-03-16 11:03 (2) Answers

Create multiple tables/grids

I've just started learning ASP.NET Core MVC based on this first-mvc-app tutorial I have a database table 'tblProducts' and I can create a single table listing all products using Model: public class tblProducts { //SQL table is named tblProduc...
more »

2017-03-15 18:03 (1) Answers

How can I hook ASP .NET compilation process?

ASP .NET Dynamically generate classes & compiles an assembly to the Temporary ASP.NET files. I would like to be able to get information when this process happens. Ultimately, I would like to have an event that will fire the name of the source fi...
more »

2017-03-15 00:03 (0) Answers

Owin claims - Add multiple ClaimTypes.Role

I have an application in which users can be assigned the following roles: SuperAdmin Admin User One user may have assigned two or more roles, eg. both SuperAdmin and User. My application uses claims, and therefore i want to authenticate user rol...
more »

2017-03-14 17:03 (1) Answers

Noob in ASP MVC Routing - 404 error

I'm new to API designing with VS2017 and I'm trying to make my simple API work with few SQL objects in a DB. I have a fairly simple project which looks like this : WebApiConfig.cs : public static void Register(HttpConfiguration config) ...
more »

2017-03-14 15:03 (3) Answers