public async Task <IActionResult> Create([Bind("Id,Solicitante,HoraDisponible,Estado,Entrevistadora")] TablaDeEntrevista tablaDeEntrevista, int idSolicitante, int idHoraDisponible, string idEstado, string idEntrevistadora) { Solicitante solicitante = _context.Solicitante.Single(x => x.Id == idSolicitante); HoraDisponible hora = _context.HoraDisponible.Single(x => x.Id == idHoraDisponible); UsuarioInterno usuario = _context.UsuarioInterno.Single(x => x.Id == idEntrevistadora); tablaDeEntrevista.Solicitante = solicitante; tablaDeEntrevista.Entrevistadora = usuario; tablaDeEntrevista.HoraDisponible = hora; if (ModelState.IsValid) { ///// Esto modifica el estado de la hora a no disponible////////// HoraDisponible horaOcupada = _context.HoraDisponible.Where(x => x.Id == hora.Id).First(); horaOcupada.Estado = "Ocupada"; Solicitante concertado = _context.Solicitante.Where(x => x.Id == solicitante.Id).First(); concertado.Proceso = "Entrevista Concertada"; ///// Esto modifica el estado del candidato a entrevista concertada///////// _context.Add(tablaDeEntrevista); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tablaDeEntrevista)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,HoraDisponible,Estado,Entrevistadora")] TablaDeEntrevista tablaDeEntrevista, int idHoraDisponible, string idEstado, string idEntrevistadora) { HoraDisponible hora = _context.HoraDisponible.Single(x => x.Id == idHoraDisponible); UsuarioInterno usuario = _context.UsuarioInterno.Single(x => x.Id == idEntrevistadora); tablaDeEntrevista.Entrevistadora = usuario; tablaDeEntrevista.HoraDisponible = hora; if (id != tablaDeEntrevista.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tablaDeEntrevista); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TablaDeEntrevistaExists(tablaDeEntrevista.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tablaDeEntrevista)); }
private async Task LoadSharedKeyAndQrCodeUriAsync(UsuarioInterno user) { // Load the authenticator key & QR code URI to display on the form var unformattedKey = await _userManager.GetAuthenticatorKeyAsync(user); if (string.IsNullOrEmpty(unformattedKey)) { await _userManager.ResetAuthenticatorKeyAsync(user); unformattedKey = await _userManager.GetAuthenticatorKeyAsync(user); } SharedKey = FormatKey(unformattedKey); var email = await _userManager.GetEmailAsync(user); AuthenticatorUri = GenerateQrCodeUri(email, unformattedKey); }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); if (ModelState.IsValid) { var user = new UsuarioInterno { UserName = Input.Email, Email = Input.Email, Nombre = Input.Nombre, Apellido = Input.Apellido }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { await _userManager.AddToRoleAsync(user, "Entrevistadora");//Para crear entrevistadora _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { userId = user.Id, code = code }, protocol: Request.Scheme); await _emailSender.SendEmailAsync(Input.Email, "Confirm your email", $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>."); //await _userManager.AddToRoleAsync(user, "Administradora"); //EN EL CASO DE QUERER CREAR UN ADMIN. await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(returnUrl)); } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
public async Task <IActionResult> OnPostConfirmationAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); // Get the information about the user from the external login provider var info = await _signInManager.GetExternalLoginInfoAsync(); if (info == null) { ErrorMessage = "Error loading external login information during confirmation."; return(RedirectToPage("./Login", new { ReturnUrl = returnUrl })); } if (ModelState.IsValid) { var user = new UsuarioInterno { UserName = Input.Email, Email = Input.Email }; var result = await _userManager.CreateAsync(user); if (result.Succeeded) { result = await _userManager.AddLoginAsync(user, info); if (result.Succeeded) { await _signInManager.SignInAsync(user, isPersistent : false); _logger.LogInformation("User created an account using {Name} provider.", info.LoginProvider); return(LocalRedirect(returnUrl)); } } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } LoginProvider = info.LoginProvider; ReturnUrl = returnUrl; return(Page()); }
// GET: TablaDeEntrevistas public async Task <IActionResult> Index() { //List<Solicitante> SolicitanteList = new List<Solicitante>(); //List<HoraDisponible> HoraDisponibleList = new List<HoraDisponible>(); //List<UsuarioInterno> UsuarioInternoList = new List<UsuarioInterno>(); ///////PRUEBA PARA VINCULAR USUARIOS Y ENTREVISTAS///// UsuarioInterno interno = await _userManager.GetUserAsync(User); /////////ESTO LO AÑADO PARA CREAR ENTREVISTAS///// //List<UsuarioInterno> UsuarioInternos = interno.UsuarioInternos; if (User.Identity.Name == "*****@*****.**") { return(View(await _context.TablaDeEntrevista.Include(x => x.Solicitante).Include(x => x.HoraDisponible).Include(x => x.Entrevistadora).ToListAsync())); } else { return(View(await _context.TablaDeEntrevista.Include(x => x.Solicitante).Include(x => x.HoraDisponible).Include(x => x.Entrevistadora).Where(x => x.Entrevistadora.UserName == User.Identity.Name).ToListAsync())); } //return View(await _context.TablaDeEntrevista.ToListAsync()); }
public IActionResult SendMailAdministradora() { //UsuarioInterno interno = await _userManager.GetUserAsync(User); //////DESCOMENTAR SI LO OTRO NO FUNCIONA///// //UsuarioInterno interno = await _userManager.Users.Include(u => u.Roles).FirstOrDefault(u => u.Email == "*****@*****.**"); //var user = userManager.Users.Include(u => u.Roles).FirstOrDefault(u => u.Email == "*****@*****.**"); /////////////CORECCION PARA ENVIO DE CORREO SIN ESTAR LOGGEADO//////////// UsuarioInterno interno = _context.Users.Single(x => x.Email == "*****@*****.**"); /////////////CORECCION PARA ENVIO DE CORREO SIN ESTAR LOGGEADO//////////// string correo = interno.Email; System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient("smtp.live.com"); var mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**");//correo de noticador if (interno.Email != null) { mail.To.Add(interno.Email);//a quien lo envio mail.Subject = "BBK BOOTCAMP"; mail.IsBodyHtml = true; string htmlBody; htmlBody = "!!Se ha inscrito un nuevo Solicitante/a!!. Ingresa a tu area personal para ver los datos "; mail.Body = htmlBody; SmtpServer.Port = 587; SmtpServer.UseDefaultCredentials = false; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "chul1t0-"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); } return(View()); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(142, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(246, 2, true); WriteLiteral("\r\n"); EndContext(); #line 7 "/Users/alfredoabelladorronsoro/Desktop/ProyectoCode4Jobs/BBKBootCamp/Views/Shared/_LoginPartial.cshtml" if (SignInManager.IsSignedIn(User)) { UsuarioInterno usuario = await UserManager.GetUserAsync(User); #line default #line hidden BeginContext(357, 4, true); WriteLiteral(" "); EndContext(); BeginContext(361, 575, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "9e092d4a8055492a9a7eb9137bdac5b8", async() => { BeginContext(535, 73, true); WriteLiteral("\r\n <ul class=\"menu-izquierdo\">\r\n <li>\r\n "); EndContext(); BeginContext(608, 138, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "b337f013405c4a7aab8ebb8fc5316dac", async() => { BeginContext(679, 13, true); WriteLiteral(" Buenos dias "); EndContext(); BeginContext(693, 14, false); #line 13 "/Users/alfredoabelladorronsoro/Desktop/ProyectoCode4Jobs/BBKBootCamp/Views/Shared/_LoginPartial.cshtml" Write(usuario.Nombre); #line default #line hidden EndContext(); BeginContext(707, 1, true); WriteLiteral(" "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(746, 183, true); WriteLiteral("\r\n </li>\r\n <li>\r\n <button type=\"submit\" class=\"btn btn-link navbar-btn navbar-link\">Cerrar sesion</button>\r\n </li>\r\n </ul>\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Area = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Page = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); if (__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-returnUrl", "Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 10 "/Users/alfredoabelladorronsoro/Desktop/ProyectoCode4Jobs/BBKBootCamp/Views/Shared/_LoginPartial.cshtml" WriteLiteral(Url.Action("Index", "Home", new { area = "" })); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-returnUrl", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(936, 2, true); WriteLiteral("\r\n"); EndContext(); #line 20 "/Users/alfredoabelladorronsoro/Desktop/ProyectoCode4Jobs/BBKBootCamp/Views/Shared/_LoginPartial.cshtml" } else { #line default #line hidden BeginContext(950, 46, true); WriteLiteral(" <ul class=\"nav navbar-nav navbar-right\">\r\n"); EndContext(); BeginContext(1105, 17, true); WriteLiteral(" \r\n </ul>\r\n"); EndContext(); #line 27 "/Users/alfredoabelladorronsoro/Desktop/ProyectoCode4Jobs/BBKBootCamp/Views/Shared/_LoginPartial.cshtml" } #line default #line hidden }
protected override void Seed(MetroUIPrueba2.Models.MooduContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. //TABLAS SIN FOREIGN KEY Areas ar1 = new Areas() { Descripcion = "Gerencia" }; Areas ar2 = new Areas() { Descripcion = "Insumo" }; Areas ar3 = new Areas() { Descripcion = "Produccion" }; context.Areas.Add(ar1); context.Areas.Add(ar2); context.Areas.Add(ar3); context.SaveChanges(); Roles rol1 = new Roles() { Descripcion = "Administrador" }; Roles rol2 = new Roles() { Descripcion = "Supervisor" }; Roles rol3 = new Roles() { Descripcion = "Trabajador" }; context.Roles.Add(rol1); context.Roles.Add(rol2); context.Roles.Add(rol3); context.SaveChanges(); Usuario us1 = new Usuario() { NombreUsuario = "Roberto123", Password = "******" }; Usuario us2 = new Usuario() { NombreUsuario = "Batman1234", Password = "******" }; Usuario us3 = new Usuario() { NombreUsuario = "roro", Password = "******" }; context.Usuarios.Add(us1); context.Usuarios.Add(us2); context.Usuarios.Add(us3); context.SaveChanges(); UsuarioInterno usi1 = new UsuarioInterno() { NombreUsuario = "nfncv", Password = "******" }; UsuarioInterno usi2 = new UsuarioInterno() { NombreUsuario = "yrttr", Password = "******" }; UsuarioInterno usi3 = new UsuarioInterno() { NombreUsuario = "hgfhg", Password = "******" }; UsuarioInterno usi4 = new UsuarioInterno() { NombreUsuario = "dster", Password = "******" }; context.UsuarioInterno.Add(usi1); context.UsuarioInterno.Add(usi2); context.UsuarioInterno.Add(usi3); context.UsuarioInterno.Add(usi4); context.SaveChanges(); Almacen a1 = new Almacen() { Descripcion = "Almacen Muebles de Produccion", Ubicacion = "Sector G, Bodega Principal", Observacion = "Sin Observacion" }; Almacen a2 = new Almacen() { Descripcion = "Almacen Muebles Diseño", Ubicacion = "Sector H, Bodega Principal", Observacion = "Sin Observacion" }; Almacen a3 = new Almacen() { Descripcion = "Almacen de Insumos", Ubicacion = "Sector A, Interior Fabrica", Observacion = "Sin Observacion" }; context.Almacenes.Add(a1); context.Almacenes.Add(a2); context.Almacenes.Add(a3); context.SaveChanges(); TipoProducto tp1 = new TipoProducto() { Nombre = "Closet", Descripcion = "Mueble para guardar ropa" }; TipoProducto tp2 = new TipoProducto() { Nombre = "Cama", Descripcion = "Mueble de habitacion" }; TipoProducto tp3 = new TipoProducto() { Nombre = "Comedor", Descripcion = "Mueble de Cocina" }; TipoProducto tp4 = new TipoProducto() { Nombre = "Comoda", Descripcion = "Mueble de habitacion usado para guardar ropa" }; context.TipoProducto.Add(tp1); context.TipoProducto.Add(tp2); context.TipoProducto.Add(tp3); context.TipoProducto.Add(tp4); context.SaveChanges(); //CatergoriaInsumo cti1 = new CatergoriaInsumo() //{ // Descripcion = "Materia Prima" //}; //CatergoriaInsumo cti2 = new CatergoriaInsumo() //{ // Descripcion = "Pinturas" //}; //CatergoriaInsumo cti3 = new CatergoriaInsumo() //{ // Descripcion = "Accesorios" //}; //context.CategoriaInsumo.Add(cti1); //context.CategoriaInsumo.Add(cti2); //context.CategoriaInsumo.Add(cti3); //context.SaveChanges(); MedioPago mp1 = new MedioPago() { Descripcion = "tarjeta credito", EntidadComercial = "Banco Estado" }; MedioPago mp2 = new MedioPago() { Descripcion = "tarjeta debito", EntidadComercial = "Banco Estado" }; context.MedioPago.Add(mp1); context.MedioPago.Add(mp2);; context.SaveChanges(); Recurso re1 = new Recurso() { Descripcion = "Madera de Pino", Umedida = "m" }; Recurso re2 = new Recurso() { Descripcion = "Tela Sintetica", Umedida = "m" }; Recurso re3 = new Recurso() { Descripcion = "Relleno de lana", Umedida = "m*3" }; context.Recurso.Add(re1); context.Recurso.Add(re2); context.Recurso.Add(re3); context.SaveChanges(); // TABLAS CON FOREIGN KEY Empleado em1 = new Empleado() { Rut = "10897213-1", Nombres = "Juan Alberto", Apellidos = "Camaño Perez", Direccion = "Arturo Prat # 2285", Telefono = "9-98765342", Correo = "*****@*****.**", Cargo = "Control Produccion", AreaId = ar3.Id, UsuarioInternoId = usi1.Id }; Empleado em2 = new Empleado() { Rut = "10358692-1", Nombres = "Manuel Bernardo", Apellidos = "Pellegrini Cortez", Direccion = "Arturo Prat # 2315", Telefono = "9-65832142", Correo = "*****@*****.**", Cargo = "Supervisor", AreaId = ar2.Id, UsuarioInternoId = usi2.Id }; Empleado em3 = new Empleado() { Rut = "19999000-2", Nombres = "Arturo Ignacio", Apellidos = "Vidal Benitez", Direccion = "Manuel Bulnes # 555", Telefono = "9-1111111", Correo = "*****@*****.**", Cargo = "Gerente", AreaId = ar1.Id, UsuarioInternoId = usi3.Id }; Empleado em4 = new Empleado() { Rut = "14071986-k", Nombres = "Marcelo Andres", Apellidos = "Placencia Velasquez", Direccion = "Igancio Serrano # 1500", Telefono = "9-4444231", Correo = "*****@*****.**", Cargo = "Ensamblador", AreaId = ar3.Id, UsuarioInternoId = usi4.Id }; context.Empleado.Add(em1); context.Empleado.Add(em2); context.Empleado.Add(em3); context.Empleado.Add(em4); context.SaveChanges(); Cliente cl1 = new Cliente() { Nombres = "Roberto Carlos", Apellidos = "Rojas Ascencio", Correo = "*****@*****.**", Telefono = 94444231, Rut = "14074567-k", UsuarioId = us1.Id }; Cliente cl2 = new Cliente() { Nombres = "Juan Pedro", Apellidos = "Perez Merea", Correo = "*****@*****.**", Telefono = 94444231, Rut = "12074437-k", UsuarioId = us2.Id }; Cliente cl3 = new Cliente() { Nombres = "Sebastian Rodolfo", Apellidos = "Mella Prieto", Correo = "*****@*****.**", Telefono = 94444231, Rut = "14567543-1", UsuarioId = us3.Id }; context.Clientes.Add(cl1); context.Clientes.Add(cl2); context.Clientes.Add(cl3); context.SaveChanges(); AsignaRoles asig1 = new AsignaRoles() { EmpleadoId = em1.Id, RolId = rol1.Id }; AsignaRoles asig2 = new AsignaRoles() { EmpleadoId = em2.Id, RolId = rol2.Id }; context.AsignaRoles.Add(asig1); context.AsignaRoles.Add(asig2); context.SaveChanges(); //estas son closets Producto p1 = new Producto() { Codigo = "pd-01", Fecha = new DateTime(2020, 6, 10), Precio = 650000, Imagen = "/pics/closets/closet_02_por.jpg", Descripcion = "La descripcion", Estado = "Produccion", TipoProductoId = tp1.Id }; Producto p2 = new Producto() { Codigo = "pd-02", Fecha = new DateTime(2020, 6, 10), Precio = 450000, Imagen = "/pics/closets/closet_05_por.jpg", Descripcion = "La descripcion2", Estado = "Produccion", TipoProductoId = tp1.Id }; Producto p3 = new Producto() { Codigo = "pd-03", Fecha = new DateTime(2020, 6, 10), Precio = 350000, Imagen = "/pics/closets/closet_01_por.jpg", Descripcion = "La descripcion3", Estado = "Produccion", TipoProductoId = tp1.Id }; Producto p4 = new Producto() { Codigo = "pd-04", Fecha = new DateTime(2020, 6, 10), Precio = 250000, Imagen = "/pics/closets/closet_04_por.jpg", Descripcion = "La descripcion4", Estado = "Produccion", TipoProductoId = tp1.Id }; context.Producto.Add(p1); context.Producto.Add(p2); context.Producto.Add(p3); context.Producto.Add(p4); context.SaveChanges(); InventarioProducto ip1 = new InventarioProducto() { Fecha = new DateTime(2020, 2, 10), Cantidad = 32, Critico = 10, Observacion = "fdfkjsdfkf", AlmacenId = a1.Id, ProductoId = p1.Id }; InventarioProducto ip2 = new InventarioProducto() { Fecha = new DateTime(2020, 2, 10), Cantidad = 45, Critico = 10, Observacion = "fdfkjsdfkf", AlmacenId = a1.Id, ProductoId = p1.Id }; InventarioProducto ip3 = new InventarioProducto() { Fecha = new DateTime(2020, 2, 10), Cantidad = 15, Critico = 5, Observacion = "fdfkjsdfkf", AlmacenId = a1.Id, ProductoId = p1.Id }; InventarioProducto ip4 = new InventarioProducto() { Fecha = new DateTime(2020, 2, 10), Cantidad = 13, Critico = 5, Observacion = "fdfkjsdfkf", AlmacenId = a2.Id, ProductoId = p3.Id }; InventarioProducto ip5 = new InventarioProducto() { Fecha = new DateTime(2020, 6, 12), Cantidad = 8, Critico = 5, Observacion = "fdfkjsdfkf", AlmacenId = a2.Id, ProductoId = p3.Id }; InventarioProducto ip6 = new InventarioProducto() { Fecha = new DateTime(2020, 6, 12), Cantidad = 23, Critico = 10, Observacion = "fdfkjsdfkf", AlmacenId = a1.Id, ProductoId = p4.Id }; context.InventarioProductos.Add(ip1); context.InventarioProductos.Add(ip2); context.InventarioProductos.Add(ip3); context.InventarioProductos.Add(ip4); context.InventarioProductos.Add(ip5); context.InventarioProductos.Add(ip6); context.SaveChanges(); Proveedor pr1 = new Proveedor() { Razon = "Empresas de Insumos S.A", Rut = "65.452.123-k", Direccion = "Los avedules # 456", Telefono = "+56 9 86425787", Email = "*****@*****.**", Contacto = "Juan Medina Garces", Comuna = "Concepcion", UsuarioInternoId = usi1.Id }; Proveedor pr2 = new Proveedor() { Razon = "Empresas de Insumos1 S.A", Rut = "70.444.666-k", Direccion = "Anibal Pinto # 456", Telefono = "+56 9 55555555", Email = "*****@*****.**", Contacto = "Bernardo Silva Medina", Comuna = "Santiago", UsuarioInternoId = usi2.Id }; context.Proveedor.Add(pr1); context.Proveedor.Add(pr2); context.SaveChanges(); //Insumo i1 = new Insumo() //{ // Descripcion = "Manillas de Comodas", // Umedida = "C/U", // CategoriaId = cti3.Id, // UsuarioInternoId = usi1.Id //}; //Insumo i2 = new Insumo() //{ // Descripcion = "Manillas de Roperos", // Umedida = "C/U", // CategoriaId = cti3.Id, // UsuarioInternoId = usi2.Id //}; //Insumo i3 = new Insumo() //{ // Descripcion = "Barniz Cafe Cipres", // Umedida = "Galon", // CategoriaId = cti2.Id, // UsuarioInternoId = usi3.Id //}; //context.Insumo.Add(i1); //context.Insumo.Add(i2); //context.Insumo.Add(i3); //context.SaveChanges(); //Pago pa1 = new Pago() //{ // Num_orden = 12, // Total = 120000, // Fecha = new DateTime(2020, 2, 25), // MedioPagoId = mp1.Id //}; //Pago pa2 = new Pago() //{ // Num_orden = 132, // Total = 1200000, // Fecha = new DateTime(2020, 2, 25), // MedioPagoId = mp1.Id //}; //Pago pa3 = new Pago() //{ // Num_orden = 11, // Total = 100000, // Fecha = new DateTime(2020, 2, 25), // MedioPagoId = mp2.Id //}; //context.Pago.Add(pa1); //context.Pago.Add(pa2); //context.Pago.Add(pa3); //context.SaveChanges(); ClienteProducto cp1 = new ClienteProducto() { NumOrden = 145, Cantidad = 12, Fecha = new DateTime(2020, 6, 10), ProductoId = p1.Id, ClienteId = cl1.Id //PagoId = pa1.Id }; ClienteProducto cp2 = new ClienteProducto() { NumOrden = 122, Cantidad = 10, Fecha = new DateTime(2020, 6, 10), ProductoId = p2.Id, ClienteId = cl2.Id //PagoId = pa2.Id }; ClienteProducto cp3 = new ClienteProducto() { NumOrden = 111, Cantidad = 3, Fecha = new DateTime(2020, 6, 10), ProductoId = p3.Id, ClienteId = cl3.Id //PagoId = pa3.Id }; //context.ClienteProducto.Add(cp1); //context.ClienteProducto.Add(cp2); //context.ClienteProducto.Add(cp3); context.SaveChanges(); //InventarioInsumo ii1 = new InventarioInsumo() //{ // Fecha = new DateTime(2020, 1, 21), // Cantidad = 50, // Critico = 50, // Observacion = "no hay", // AlmacenId = a3.Id, // InsumoId = i2.Id //}; //InventarioInsumo ii2 = new InventarioInsumo() //{ // Fecha = new DateTime(2020, 1, 21), // Cantidad = 150, // Critico = 50, // Observacion = "no hay", // AlmacenId = a3.Id, // InsumoId = i1.Id //}; //context.InventarioInsumo.Add(ii1); //context.InventarioInsumo.Add(ii2); //context.SaveChanges(); //CompraInsumo ci1 = new CompraInsumo() //{ // Fecha = new DateTime(2020, 2, 25), // Valor = 3000, // Cantidad = 100, // Observacion = "fsfdsdsf", // InsumoId = i1.Id, // ProveedorId = pr1.Id //}; //CompraInsumo ci2 = new CompraInsumo() //{ // Fecha = new DateTime(2020, 2, 25), // Valor = 2500, // Cantidad = 150, // Observacion = "fsfdsdsf", // InsumoId = i2.Id, // ProveedorId = pr1.Id //}; //context.CompraInsumo.Add(ci1); //context.CompraInsumo.Add(ci2); //context.SaveChanges(); //ProveeInsumo pri1 = new ProveeInsumo() //{ // InsumoId = i2.Id, // ProveedorId = pr1.Id //}; //ProveeInsumo pri2 = new ProveeInsumo() //{ // InsumoId = i2.Id, // ProveedorId = pr1.Id //}; //context.ProveeInsumo.Add(pri1); //context.ProveeInsumo.Add(pri2); //context.SaveChanges(); }