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" });
        }
        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));
        }
 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();
     }
 }
 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();
     }
 }
 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();
     }
 }
Example #6
0
 public LopDao()
 {
     db = new DoAnDbContext();
 }
Example #7
0
 public HocVuDao()
 {
     db = new DoAnDbContext();
 }
Example #8
0
 public UserDao()
 {
     db = new DoAnDbContext();
 }
Example #9
0
 public VaiTroDao()
 {
     db = new DoAnDbContext();
 }
 public ApplicationUserStore(DoAnDbContext context)
     : base(context)
 {
 }
Example #11
0
 public DanhMucDao()
 {
     db = new DoAnDbContext();
 }
Example #12
0
 public VaiTroChucNangDao()
 {
     db = new DoAnDbContext();
 }
Example #13
0
 public DonViDao()
 {
     db = new DoAnDbContext();
 }
Example #14
0
 public DoAnDbContext Init()
 {
     return(dbContext ?? (dbContext = new DoAnDbContext()));
 }
Example #15
0
 public ChucNangDao()
 {
     db = new DoAnDbContext();
 }