-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartup.cs
91 lines (75 loc) · 2.91 KB
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//using Microsoft.Owin;
//using Owin;
//using System;
//using System.Threading.Tasks;
//using WebBanHangCuaKhanhBang.Models;
////Sử dụng các thư viện
//using Microsoft.AspNet.Identity;
//using Microsoft.Owin.Security.Cookies;
//using Microsoft.AspNet.Identity.EntityFramework;
//using WebBanHangCuaKhanhBang.Identity;
//[assembly: OwinStartup(typeof(WebBanHangCuaKhanhBang.Startup))]
//namespace WebBanHangCuaKhanhBang
//{
// public class Startup
// {
// public void Configuration(IAppBuilder app)
// {
// app.UseCookieAuthentication(new CookieAuthenticationOptions()
// {
// AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
// LoginPath = new PathString("/Acount/login")
// });
// //this.CreateRolesAndUsers();
// }
// //public void CreateRolesAndUsers()
// //{
// // var roleManneger = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(new AppDbContext()));
// // var appDBContext = new AppDbContext();
// // var appUserStore = new AppUserStore(appDBContext);
// // var userManager = new AppUserManager(appUserStore);
// // if (!roleManneger.RoleExists("Admin"))
// // {
// // var role = new IdentityRole();
// // role.Name = "Admin";
// // roleManneger.Create(role);
// // }
// // if (userManager.FindByName("admin") == null)
// // {
// // var user = new AppUser();
// // user.UserName = "admin";
// // user.Email = "[email protected]";
// // string userPwd = "nammoPhat";
// // var chkUser = userManager.Create(user, userPwd);
// // if (chkUser.Succeeded)
// // {
// // userManager.AddToRole(user.Id, "Admin");
// // }
// // }
// // if (!roleManneger.RoleExists("Manager"))
// // {
// // var role = new IdentityRole();
// // role.Name = "Manager";
// // roleManneger.Create(role);
// // }
// // if (userManager.FindByName("manager") == null)
// // {
// // var user = new AppUser();
// // user.UserName = "manager";
// // user.Email = "[email protected]";
// // string userPwd = "nammoPhap";
// // var chkUser = userManager.Create(user, userPwd);
// // if (chkUser.Succeeded)
// // {
// // userManager.AddToRole(user.Id, "Manager");
// // }
// // }
// // if (!roleManneger.RoleExists("Customer"))
// // {
// // var role = new IdentityRole();
// // role.Name = "Customer";
// // roleManneger.Create(role);
// // }
// }
// }
//}