Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Editing Users - Identity 2.0

$
0
0

Hello I am using identity,  here is my identity model with some custom properties:

    // You can add User data for the user by adding more properties to your User class, please visit https://go.microsoft.com/fwlink/?LinkID=317594 to learn more.



  


    public class ApplicationUser : IdentityUser
    {

        public int supplierId { get; set; }
        public string supplierName { get; set; }
        public string firstLogin { get; set; }
        public string WebStatus { get; set; }
        [Column(TypeName = "datetime2")]
        public DateTime LastLogDateTime { get; set; }



        public ClaimsIdentity GenerateUserIdentity(ApplicationUserManager manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = manager.CreateIdentity(this, DefaultAuthenticationTypes.ApplicationCookie);
            // Add custom user claims here
            return userIdentity;
        }

        public Task<ClaimsIdentity> GenerateUserIdentityAsync(ApplicationUserManager manager)
        {
            return Task.FromResult(GenerateUserIdentity(manager));
        }


      





    }

    public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public ApplicationDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)
        {
        }

        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }
    }
}

Basically I have a supplier model which is binded to a grid with an edit users button - on click I want it to bring up a grid with users that belong to that supplier.

From here I want to be able to edit user info, delete, add new and reset password.

How do I go about this?

Thanks


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>