I have developed an application in this i have created a model class named UserModel.cs, in this class i write code as:
namespace Demo2.Models
{
[Table("User_Mst")]
public class UserModel
{
[Key]
public Int64 Id { get; set; }
[StringLength(50)]
public String User_Name { get; set; }
[StringLength(50)]
public String Password { get; set; }
}
public class UserContextDB : DbContext
{
[Key]
public DbSet<usermodel> Users { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<pluralizingtablenameconvention>();
}
}
}
I have done migration using command "enable-migrations -contexttypename UserContextDB"
then i created controller (using template named "MVC controller with read/write actions and views, using Entity Framework").views automatically added correspond to this model, i also defined my own database in connection string named "UserContextDB".
But whenever i tried to save values from "create" view then these values are not saving in my own database, it uses other database.
I want to store all values in my own database. Please provide me help.
Thanks