Posted By

Dmix on 11/25/14


Tagged

calendar event control web scheduler aspnet manager Development Task mvc5


Versions (?)

Creating Task Manager in ASP.NET MVC5


 / Published in: C#
 

URL: http://scheduler-net.com/docs/tutorials-task-manager-mvc5.html

A step-by-step tutorial that explains how to build a task manager with two user types (Manager and Employee) in ASP.NET MVC5. The task manager is built with the use of ASP.NET Identity, Entity Framework and DHTMLX Scheduler .NET web control. Ready to download sample is attached.

  1. using System.Security.Claims;
  2. using System.Threading.Tasks;
  3. using Microsoft.AspNet.Identity;
  4. using Microsoft.AspNet.Identity.EntityFramework;
  5.  
  6. namespace Scheduler.MVC5.Users
  7. {
  8. /// <summary>
  9. /// represents default EntityFramework IUser implementation
  10. /// </summary>
  11. public class ApplicationUser : IdentityUser
  12. {
  13. public async Task<ClaimsIdentity> GenerateUserIdentityAsync(AppUserManager manager)
  14. {
  15. return await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
  16. }
  17. }
  18. /// <summary>
  19. /// represents a class that uses the default entity types for ASP.NET Identity Users, Roles, Claims, Logins
  20. /// </summary>
  21. public class UserIdentityDbContext : IdentityDbContext<ApplicationUser>
  22. {
  23. public UserIdentityDbContext()
  24. : base("TaskManagerString")
  25. {
  26. }
  27.  
  28. public UserIdentityDbContext Create()
  29. {
  30. return new UserIdentityDbContext();
  31. }
  32.  
  33. protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
  34. {
  35. base.OnModelCreating(modelBuilder);
  36. modelBuilder.Entity<ApplicationUser>().ToTable("Users");
  37. modelBuilder.Entity<IdentityRole>().ToTable("Roles");
  38. modelBuilder.Entity<IdentityUserRole>().ToTable("UserInRoles");
  39.  
  40. }
  41. }
  42. }

Report this snippet  

You need to login to post a comment.