Exemplo n.º 1
0
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              ControleDeLeiloesDbContext context,
                              UserManager <Usuario> userManager,
                              RoleManager <IdentityRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            UsuarioRoleDefault.Seed(context, userManager, roleManager).Wait();

            app.UseEndpoints(endpoints =>
            {
                //routes.MapRoute("modulos","Prontuario/{controller=Home}/{action=Index}/{id?}");

                //routes.MapRoute("pacientes","{controller=Home}/{action=Index}/{id}/{paciente}");

                //endpoints.MapAreaControllerRoute(
                //    name: "logout",
                //    areaName: "Identity",
                //    pattern: "Identity/Account/Logout");

                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");


                endpoints.MapRazorPages();
            });

            //app.UseMvc(routes =>
            //{
            //    //routes.MapRoute("modulos","Prontuario/{controller=Home}/{action=Index}/{id?}");
            //    //routes.MapRoute("pacientes","{controller=Home}/{action=Index}/{id}/{paciente}");

            //    routes.MapRoute(
            //        name: "default",
            //        template: "{controller=Home}/{action=Index}/{id?}");
            //});
        }
Exemplo n.º 2
0
        //private readonly UserManager<Parceiro> _userManager;
        //private readonly SignInManager<Parceiro> _signInManager;
        //private readonly RoleManager<IdentityRole> _roleManager;

        public LeiloeirosController(ControleDeLeiloesDbContext context
                                    //UserManager<Parceiro> userManager,
                                    //SignInManager<Parceiro> signInManager
                                    //RoleManager<IdentityRole> roleManager,
                                    )
        {
            _context = context;
            //_userManager = userManager;
            //_signInManager = signInManager;
            //_roleManager = roleManager;
        }
Exemplo n.º 3
0
        public static async Task Seed(ControleDeLeiloesDbContext context, UserManager <Usuario> userManager,
                                      RoleManager <IdentityRole> roleManager)
        {
            var user = new Usuario
            {
                Nome           = "Marcelo Rodrigues Martins",
                UserName       = "******",
                Celular        = "61992562507",
                Email          = "*****@*****.**",
                PhoneNumber    = "61992562507",
                Endereco       = "QS 16, Conjunto 1D, Casa 1, Riacho Fundo I-DF, CEP 71825-644",
                EmailConfirmed = true
            };
            const string password = "******"; // Todo: Inportante seguir as regras
            const string roleName = "Administrator";


            context.Database.Migrate();
            //role User
            if (await roleManager.FindByNameAsync("User") == null)
            {
                await roleManager.CreateAsync(new IdentityRole("User"));
            }

            //role Administrator
            if (await roleManager.FindByNameAsync(roleName) == null)
            {
                await roleManager.CreateAsync(new IdentityRole(roleName));
            }

            if (await userManager.FindByNameAsync(user.UserName) == null)
            {
                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, roleName);

                    //create Avatar default
                    var base64image = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCACAAIADASIAAhEBAxEB/8QAHgAAAgICAwEBAAAAAAAAAAAAAAkFCAYHAQIEAwr/xABLEAABAgQDBAUGCQkGBwAAAAACAwQABQYSAQcICRMiMhEUQlJiFSEjcoKSFjEzNkNRdYOzJDRBU2Nxc4GTYZGio7LCGBlEdKG0xP/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwBqcEEEAQRD1PU8houQPamqiatpZK5ekS7l25UsSSDD9JFCqdRm0Qzj1I1gpkboxks4SZOjNuc0ZJWzCYhykSZ4/mqFxc/CfLxDdbAXi1Ca79O+nLfy6ratxmdQJD5pFJ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bLGY5f5iU7UTfDnOWzRJxZ61hcMZeJXFCsK12JOAOidZZZ8KooiNyTadym5QS/jomP4UYh/y29f8ASOBJ0vqIZN2yZbtPqNUztArfUBvAN+JUB5owCvs+slMqk8Vcxs1aYp/HHDgSfTRJNU/VSuvP2RhYGOzC1z1ziCFd6hZU6Yr4+mwe1FOHh4fdqoCJe9Ge0DsSKdRX3+ZmecwfI8OPVpFKwbF/VVJX/RAZxnTtislaSFSXZMU3Mq8mGI4Wu1hKXS4MfWVHfHiP1boR8UVul2V2vbaUThvUFfvVqUy9NYVUjdoKspWkHSPG1Z3b12XQRkBmRD03DvQ+KGIZM6A9LGR6yL+l8sWczmyRAQTWel5QdCY/EY73gSL+EAxYlMATAQAbRHswGhNMGjTJvSzI+rURJsH0/dp2TKoH4Co9c4X3WiXR6JLpt9EHm6BC68uON/wQQBEJW3zKn/2W6/CKJuIWtcLqNnw/XLHX4RQH/9k=";
                    if (base64image != null)
                    {
                        byte[] bytes = Convert.FromBase64String(base64image.Substring(23));
                        var    path  = Path.Combine(Directory.GetCurrentDirectory(),
                                                    "wwwroot/img/avatars", user.UserName + ".jpg");
                        var imageFile = new FileStream(path, FileMode.Create);
                        imageFile.Write(bytes, 0, bytes.Length);
                        imageFile.Flush();
                    }
                }
            }
        }
        //private readonly RoleManager<IdentityRole> _roleManager;

        public ProdutosController(ControleDeLeiloesDbContext context,
                                  UserManager <Usuario> userManager,
                                  SignInManager <Usuario> signInManager
                                  //RoleManager<IdentityRole> roleManager,
                                  )
        {
            _userManager   = userManager;
            _signInManager = signInManager;
            //_roleManager = roleManager;
            _context = context;
        }
Exemplo n.º 5
0
 public UsuariosController(ControleDeLeiloesDbContext context,
                           UserManager <Usuario> userManager,
                           SignInManager <Usuario> signInManager,
                           RoleManager <IdentityRole> roleManager,
                           IHostEnvironment env)
 {
     _context       = context;
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
     _env           = env;
 }
 public LeiloesController(ControleDeLeiloesDbContext context)
 {
     _context = context;
 }
Exemplo n.º 7
0
 public AnunciosController(ControleDeLeiloesDbContext context)
 {
     _context = context;
 }
 public LeiloeirosControllerant(ControleDeLeiloesDbContext context)
 {
     _context = context;
 }
 public VendedorProibidosController(ControleDeLeiloesDbContext context)
 {
     _context = context;
 }