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(); } }
public LopDao() { db = new DoAnDbContext(); }
public HocVuDao() { db = new DoAnDbContext(); }
public UserDao() { db = new DoAnDbContext(); }
public VaiTroDao() { db = new DoAnDbContext(); }
public ApplicationUserStore(DoAnDbContext context) : base(context) { }
public DanhMucDao() { db = new DoAnDbContext(); }
public VaiTroChucNangDao() { db = new DoAnDbContext(); }
public DonViDao() { db = new DoAnDbContext(); }
public DoAnDbContext Init() { return(dbContext ?? (dbContext = new DoAnDbContext())); }
public ChucNangDao() { db = new DoAnDbContext(); }