Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AnCristina

@AnCristina
About
Posts
12
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Asp Mvc 5 user registration fails
    A AnCristina

    Hello , I am trying to make a custom login page . On adding the password to AspNetUsers I get the following error : Cannot insert explicit value for identity column in table 'AspNetUsers' when IDENTITY_INSERT is set to OFF. Source Error: Line 86: Line 87: var user = new ApplicationUser() { UserName = model.UserName }; Line 88: var result = await UserManager.CreateAsync(user, model.Password); Line 89: ApplicationUser appusr = new ApplicationUser(); Line 90: IdentityUserRole idnt = new IdentityUserRole(); Is there any way to solve this without changing the identity column . The default field is Id nvarchar(128) .

    ASP.NET asp-net architecture help

  • ASP MVC 5 application users
    A AnCristina

    It worked . Thank you very much ! :)

    ASP.NET asp-net architecture tutorial question announcement

  • ASP MVC 5 application users
    A AnCristina

    Ok , I got stuck again . So I created the classes : Role :

    public class Role
    {
        public Role() { }
        public Role(string name, int id):this()
        {
            this.RoleId = id;
            this.Name = name;
        }
        \[Key\]
        \[Required\]
        public virtual int RoleId { get; set; }
        public virtual string Name { get; set; }
    }
    

    Permission :

        public Permission()
        { }
        public Permission(string name,int id):this()
        {
            this.Name=name;
            this.Id = id;
        }
        \[Key\]
        \[Required\]
        public virtual int Id { get; set; }
        public virtual string Name { get; set; }
    }
    

    RolePermission :

    public class RolePermission
    {
        public Role Role { get; set; }
        public Permission Group { get; set; }
        \[Required\]
        public int RoleGroupId { get; set; }
        public RolePermission() { }
    
    }
    

    I updated the ApplicationUser class

    public class ApplicationUser : IdentityUser
    {
        public ApplicationUser()
            : base()
        {
            this.Permission=new HashSet();
        }
        \[Required\]
        public string Name { get; set; }
        public virtual ICollection Permission { get; set; }
    }
    

    Is this correct up to this point ? I suppose I should modify the ApplicationDbContext , which , up to this point , looks like this :

    public class ApplicationDbContext : IdentityDbContext
    {
        public ApplicationDbContext()
            : base("DefaultConnection")
        {
    
        }
    }
    

    What changes should I do ?

    ASP.NET asp-net architecture tutorial question announcement

  • ASP MVC 5 application users
    A AnCristina

    Thank you very much ! :)

    ASP.NET asp-net architecture tutorial question announcement

  • ASP MVC 5 application users
    A AnCristina

    Ok , in other words I should have three classes : Role Permission RolePermission(in which I should include two objects , one of type Role , and one of type Permission) And I should link the RolePermission to the ApplicationUser , then apply the migration . Is that correct ?

    ASP.NET asp-net architecture tutorial question announcement

  • ASP MVC 5 application users
    A AnCristina

    Hello ! I am building a MVC 5 app in which there will be 4 types of users . (Admin , HR Member , Managers , Employee) . I already created the views and the controllers for each type . I want to give each manager access to certain departments , and the employee access to data according to his employeeID value . After reading several articles on the Internet about this topic , I suppose I have to assign each user type a role and each department/employeeID a permission , but I have no clue on how to do that . Can someone explain to me how to implement this ? I mention that the Identity Framework installed on the project is at version 1.0 .

    ASP.NET asp-net architecture tutorial question announcement

  • LINQ sums for distinct values
    A AnCristina

    Hello ! I have the following values . ________________________________________ Department ID|||||Income ---------------------------------------- 100 ||||| 350 200 ||||| 500 300 ||||| 450 100 ||||| 600 500 ||||| 550 200 ||||| 700 _______________________________________ How can I get the sum of Income for each Department ID , providing that the values come from separate tables ? I want to display each distinct department id too .

    LINQ question csharp linq

  • MVC 5 Scaffolded view problem
    A AnCristina

    I created the view , but renamed it , so the controller didn't recognize it . Thanks !

    ASP.NET question help csharp asp-net visual-studio

  • MVC 5 Scaffolded view problem
    A AnCristina

    Problem solved , apparently my view wasn't named properly .

    ASP.NET question help csharp asp-net visual-studio

  • MVC 5 Scaffolded view problem
    A AnCristina

    Hello ! I want to create a MVC 5 application using Visual Studio 2013 . I have the following problem : I created a controller to display data from a table and then created a view using Add View for the

    return View();

    method . The view is created , but when I try to go to the view from the controller , the "Unable to find a matching view" error is shown . How can I link the view to the controller ? Sorry if this question was asked before .

    ASP.NET question help csharp asp-net visual-studio

  • MVC 4 Local Database
    A AnCristina

    I managed to solve the problem by creating the model using an existing database . Thanks !

    .NET (Core and Framework) help csharp asp-net database visual-studio

  • MVC 4 Local Database
    A AnCristina

    Hello ! I want to build a MVC 4 app database using Entity Framework Code First . I have the following problem : I've tried to create a local database with 2 tables in it (I declared 2 classes and then attached them in a DbContext class) , and then wrote the following connection string :

    The database doesn't seem to be created after running the application , since it doesn't appear in the Server Explorer and in the App_Data Folder . I use Visual Studio 2012 . Can you please help me solve this problem ?

    .NET (Core and Framework) help csharp asp-net database visual-studio
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups