コード例 #1
0
        private void CreateUser(DoAnDbContext context)
        {
            var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new DoAnDbContext()));

            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new DoAnDbContext()));

            var user = new ApplicationUser()
            {
                UserName       = "******",
                Email          = "*****@*****.**",
                EmailConfirmed = true,
                BirthDay       = DateTime.Now,
                FullName       = "admin"
            };

            manager.Create(user, "123456$");

            if (!roleManager.Roles.Any())
            {
                roleManager.Create(new IdentityRole {
                    Name = "Admin"
                });
                roleManager.Create(new IdentityRole {
                    Name = "User"
                });
            }

            var adminUser = manager.FindByEmail("*****@*****.**");

            manager.AddToRoles(adminUser.Id, new string[] { "Admin", "User" });
        }
コード例 #2
0
        public ActionResult Index(string searchString, int page = 1, int pageSize = 100)
        {
            User a     = CheckAuthorize.Instance.XuatUserID();
            var  dao   = new HocVuDao();
            var  model = dao.ListLichSu(searchString, page, pageSize, a);

            ViewBag.SearchString = searchString;
            List <HocVuViewModel> list = new List <HocVuViewModel>();

            using (DoAnDbContext db = new DoAnDbContext())
            {
                list = list.OrderBy(x => x.HocVuID).ToList();
            }
            return(View(model));
        }
コード例 #3
0
 private void CreateCustomHeader(DoAnDbContext context)
 {
     if (context.CustomHeaders.Count() == 0)
     {
         List <CustomHeader> listCustomHeader = new List <CustomHeader>
         {
             new CustomHeader()
             {
                 Type = "Header", Status = true, CreatedDate = DateTime.Now
             },
         };
         context.CustomHeaders.AddRange(listCustomHeader);
         context.SaveChanges();
     }
 }
コード例 #4
0
 private void CreateCustomImage(DoAnDbContext context)
 {
     if (context.CustomImages.Count() == 0)
     {
         List <CustomImage> listCustomImage = new List <CustomImage>
         {
             new CustomImage()
             {
                 Type = "Logo", Status = true, CreatedDate = DateTime.Now
             },
             new CustomImage()
             {
                 Type = "Background", Status = true, CreatedDate = DateTime.Now
             }
         };
         context.CustomImages.AddRange(listCustomImage);
         context.SaveChanges();
     }
 }
コード例 #5
0
 private void CreateControlPanel(DoAnDbContext context)
 {
     if (context.Controlpanels.Count() == 0)
     {
         List <ControlPanel> listControlPanel = new List <ControlPanel>
         {
             new ControlPanel()
             {
                 Name = "Tổ chức", Status = false
             },
             new ControlPanel()
             {
                 Name = "Quyên góp", Status = true
             }
         };
         context.Controlpanels.AddRange(listControlPanel);
         context.SaveChanges();
     }
 }
コード例 #6
0
 public LopDao()
 {
     db = new DoAnDbContext();
 }
コード例 #7
0
 public HocVuDao()
 {
     db = new DoAnDbContext();
 }
コード例 #8
0
ファイル: UserDao.cs プロジェクト: HoangNhatNam/DoAnCoSo
 public UserDao()
 {
     db = new DoAnDbContext();
 }
コード例 #9
0
 public VaiTroDao()
 {
     db = new DoAnDbContext();
 }
コード例 #10
0
 public ApplicationUserStore(DoAnDbContext context)
     : base(context)
 {
 }
コード例 #11
0
ファイル: DanhMucDao.cs プロジェクト: HoangNhatNam/DoAnCoSo
 public DanhMucDao()
 {
     db = new DoAnDbContext();
 }
コード例 #12
0
 public VaiTroChucNangDao()
 {
     db = new DoAnDbContext();
 }
コード例 #13
0
ファイル: DonViDao.cs プロジェクト: KimQuangdlu/DoAnCoSo_QNL
 public DonViDao()
 {
     db = new DoAnDbContext();
 }
コード例 #14
0
 public DoAnDbContext Init()
 {
     return(dbContext ?? (dbContext = new DoAnDbContext()));
 }
コード例 #15
0
 public ChucNangDao()
 {
     db = new DoAnDbContext();
 }