From 141d9c6389f69aa96cc6cfcd204661bf10f4b281 Mon Sep 17 00:00:00 2001 From: mattmachad Date: Fri, 29 Nov 2024 20:38:32 -0300 Subject: [PATCH 1/2] codigo-limpado --- .../Prova/Controllers/MarcasController.cs | 10 +- .../Prova/Controllers/ProduotsController.cs | 8 +- .../Prova/Controllers/UsuarioController.cs | 1 - Prova2_Henrique/Prova/DTO/EnderecoDTO.cs | 2 - .../Prova/DTO/UsuarioAtualizacaoDTO.cs | 3 - .../Prova/DTO/UsuarioCadastroDTO.cs | 3 - .../20241023181253_InitialCreate.Designer.cs | 106 --------- .../20241023181253_InitialCreate.cs | 65 ------ .../20241023182454_AjusteEndereco.Designer.cs | 106 --------- .../20241023182454_AjusteEndereco.cs | 19 -- ...3035_AlterEnderecoIdGeneration.Designer.cs | 106 --------- ...0241023183035_AlterEnderecoIdGeneration.cs | 19 -- ...20241101235914_NomeDaMigration.Designer.cs | 107 --------- .../20241101235914_NomeDaMigration.cs | 81 ------- .../20241118214851_secondCreate.Designer.cs | 162 ------------- .../Migrations/20241118214851_secondCreate.cs | 61 ----- .../20241127022231_produtos.Designer.cs | 175 -------------- .../Migrations/20241127022231_produtos.cs | 48 ---- .../20241127171458_lista.Designer.cs | 217 ------------------ .../Prova/Migrations/20241127171458_lista.cs | 57 ----- .../20241127193747_funcionapfv.Designer.cs | 217 ------------------ .../Migrations/20241127193747_funcionapfv.cs | 22 -- ...41129060230_atualizandoUsuario.Designer.cs | 183 --------------- .../20241129060230_atualizandoUsuario.cs | 79 ------- ...129071042_mudandoOTipoDaImagem.Designer.cs | 183 --------------- .../20241129071042_mudandoOTipoDaImagem.cs | 28 --- ..._mudandoOTipoDaIamgemNovamente.Designer.cs | 183 --------------- ...129071811_mudandoOTipoDaIamgemNovamente.cs | 22 -- ...mudandoOTipoDaIamgemNovamente2.Designer.cs | 183 --------------- ...29072043_mudandoOTipoDaIamgemNovamente2.cs | 28 --- ...mudandoOTipoDaIamgemNovamente3.Designer.cs | 183 --------------- ...29072432_mudandoOTipoDaIamgemNovamente3.cs | 28 --- ...mudandoOTipoDaIamgemNovamente5.Designer.cs | 179 --------------- ...29073354_mudandoOTipoDaIamgemNovamente5.cs | 29 --- ...mudandoOTipoDaIamgemNovamente7.Designer.cs | 183 --------------- ...29073810_mudandoOTipoDaIamgemNovamente7.cs | 29 --- ...mudandoOTipoDaIamgemNovamente8.Designer.cs | 184 --------------- ...29074050_mudandoOTipoDaIamgemNovamente8.cs | 36 --- ...udandoOTipoDaIamgemNovamente10.Designer.cs | 183 --------------- ...9080256_mudandoOTipoDaIamgemNovamente10.cs | 36 --- ...udandoOTipoDaIamgemNovamente12.Designer.cs | 183 --------------- ...9081217_mudandoOTipoDaIamgemNovamente12.cs | 22 -- ...udandoOTipoDaIamgemNovamente13.Designer.cs | 184 --------------- ...9081646_mudandoOTipoDaIamgemNovamente13.cs | 36 --- ...udandoOTipoDaIamgemNovamente15.Designer.cs | 179 --------------- ...9082124_mudandoOTipoDaIamgemNovamente15.cs | 47 ---- ...udandoOTipoDaIamgemNovamente18.Designer.cs | 179 --------------- .../20241129173606_NomeDaMigration1221212.cs | 22 -- ...241129233214_euteamoluquinhas.Designer.cs} | 4 +- ....cs => 20241129233214_euteamoluquinhas.cs} | 2 +- Prova2_Henrique/Prova/Models/Produto.cs | 1 - Prova2_Henrique/Prova/Models/Usuario.cs | 1 - Prova2_Henrique/Prova/Program.cs | 12 +- .../Prova/Repositories/MarcaRepository.cs | 2 - .../Prova/Repositories/ProdutoRepository.cs | 2 - .../Prova/Repositories/UsuarioRepository.cs | 6 +- .../Prova/Services/MarcaService.cs | 2 - .../Prova/Services/ProdutoService.cs | 2 - .../Prova/Services/UsuarioService.cs | 8 +- 59 files changed, 18 insertions(+), 4430 deletions(-) delete mode 100644 Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241127022231_produtos.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241127171458_lista.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.cs rename Prova2_Henrique/Prova/Migrations/{20241129173606_NomeDaMigration1221212.Designer.cs => 20241129233214_euteamoluquinhas.Designer.cs} (98%) rename Prova2_Henrique/Prova/Migrations/{20241129083237_mudandoOTipoDaIamgemNovamente18.cs => 20241129233214_euteamoluquinhas.cs} (98%) diff --git a/Prova2_Henrique/Prova/Controllers/MarcasController.cs b/Prova2_Henrique/Prova/Controllers/MarcasController.cs index 1f73dea..c7b7e8a 100644 --- a/Prova2_Henrique/Prova/Controllers/MarcasController.cs +++ b/Prova2_Henrique/Prova/Controllers/MarcasController.cs @@ -1,8 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Prova.Models; using Prova.Services; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Prova.Controllers { @@ -18,14 +16,14 @@ public MarcaController(MarcaService marcaService) } [HttpGet] - public async Task>> GetAllMarcas() + public async Task>> GetTodasMarcas() { var marcas = await _marcaService.GetAllAsync(); return Ok(marcas); } [HttpGet("{id}")] - public async Task> GetMarcaById(int id) + public async Task> GetMarcaPorId(int id) { var marca = await _marcaService.GetByIdAsync(id); if (marca == null) @@ -38,8 +36,8 @@ public async Task> GetMarcaById(int id) [HttpPost] public async Task> CreateMarca(Marca marca) { - var newMarca = await _marcaService.AddAsync(marca); - return CreatedAtAction(nameof(GetMarcaById), new { id = newMarca.Id }, newMarca); + var novaMarca = await _marcaService.AddAsync(marca); + return CreatedAtAction(nameof(GetMarcaPorId), new { id = novaMarca.Id }, novaMarca); } } } diff --git a/Prova2_Henrique/Prova/Controllers/ProduotsController.cs b/Prova2_Henrique/Prova/Controllers/ProduotsController.cs index df396cf..9e6f404 100644 --- a/Prova2_Henrique/Prova/Controllers/ProduotsController.cs +++ b/Prova2_Henrique/Prova/Controllers/ProduotsController.cs @@ -18,14 +18,14 @@ public ProdutoController(ProdutoService produtoService) } [HttpGet] - public async Task>> GetAllProdutos() + public async Task>> GetTodosProdutos() { var produtos = await _produtoService.GetAllAsync(); return Ok(produtos); } [HttpGet("{id}")] - public async Task> GetProdutoById(int id) + public async Task> GetProdutoPorId(int id) { var produto = await _produtoService.GetByIdAsync(id); if (produto == null) @@ -38,8 +38,8 @@ public async Task> GetProdutoById(int id) [HttpPost] public async Task> CreateProduto(Produto produto) { - var newProduto = await _produtoService.AddAsync(produto); - return CreatedAtAction(nameof(GetProdutoById), new { id = newProduto.Id }, newProduto); + var novoProduto = await _produtoService.AddAsync(produto); + return CreatedAtAction(nameof(GetProdutoPorId), new { id = novoProduto.Id }, novoProduto); } [HttpDelete] diff --git a/Prova2_Henrique/Prova/Controllers/UsuarioController.cs b/Prova2_Henrique/Prova/Controllers/UsuarioController.cs index f66962c..717897f 100644 --- a/Prova2_Henrique/Prova/Controllers/UsuarioController.cs +++ b/Prova2_Henrique/Prova/Controllers/UsuarioController.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Mvc; using Prova.DTOs; -using Prova.Models; using Prova.Services; namespace Prova.Controllers diff --git a/Prova2_Henrique/Prova/DTO/EnderecoDTO.cs b/Prova2_Henrique/Prova/DTO/EnderecoDTO.cs index ff2247a..370f75b 100644 --- a/Prova2_Henrique/Prova/DTO/EnderecoDTO.cs +++ b/Prova2_Henrique/Prova/DTO/EnderecoDTO.cs @@ -1,5 +1,3 @@ -using System; - namespace Prova.DTOs { public class EnderecoDTO diff --git a/Prova2_Henrique/Prova/DTO/UsuarioAtualizacaoDTO.cs b/Prova2_Henrique/Prova/DTO/UsuarioAtualizacaoDTO.cs index 7e07675..3402810 100644 --- a/Prova2_Henrique/Prova/DTO/UsuarioAtualizacaoDTO.cs +++ b/Prova2_Henrique/Prova/DTO/UsuarioAtualizacaoDTO.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using Prova.Models; namespace Prova.DTOs { diff --git a/Prova2_Henrique/Prova/DTO/UsuarioCadastroDTO.cs b/Prova2_Henrique/Prova/DTO/UsuarioCadastroDTO.cs index cebcf0c..f13dd24 100644 --- a/Prova2_Henrique/Prova/DTO/UsuarioCadastroDTO.cs +++ b/Prova2_Henrique/Prova/DTO/UsuarioCadastroDTO.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; -using Prova.Models; namespace Prova.DTOs { diff --git a/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs deleted file mode 100644 index 0369fc8..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241023181253_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.cs b/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.cs deleted file mode 100644 index b1f186e..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class InitialCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Usuarios", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: false), - Sobrenome = table.Column(type: "nvarchar(max)", nullable: false), - Telefone = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Senha = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Usuarios", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Enderecos", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Cep = table.Column(type: "nvarchar(max)", nullable: false), - Cidade = table.Column(type: "nvarchar(max)", nullable: false), - Estado = table.Column(type: "nvarchar(max)", nullable: false), - UsuarioId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Enderecos", x => x.Id); - table.ForeignKey( - name: "FK_Enderecos_Usuarios_UsuarioId", - column: x => x.UsuarioId, - principalTable: "Usuarios", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Enderecos_UsuarioId", - table: "Enderecos", - column: "UsuarioId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Enderecos"); - - migrationBuilder.DropTable( - name: "Usuarios"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs deleted file mode 100644 index 4aea357..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241023182454_AjusteEndereco")] - partial class AjusteEndereco - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.cs b/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.cs deleted file mode 100644 index 775a1da..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class AjusteEndereco : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs deleted file mode 100644 index 9041a66..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241023183035_AlterEnderecoIdGeneration")] - partial class AlterEnderecoIdGeneration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.cs b/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.cs deleted file mode 100644 index cf8267a..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class AlterEnderecoIdGeneration : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs deleted file mode 100644 index 78533b6..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241101235914_NomeDaMigration")] - partial class NomeDaMigration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.cs b/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.cs deleted file mode 100644 index b09ed19..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class NomeDaMigration : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "DataNascimento", - table: "Usuarios", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AlterColumn( - name: "Estado", - table: "Enderecos", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Cidade", - table: "Enderecos", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Cep", - table: "Enderecos", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DataNascimento", - table: "Usuarios"); - - migrationBuilder.AlterColumn( - name: "Estado", - table: "Enderecos", - type: "nvarchar(max)", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Cidade", - table: "Enderecos", - type: "nvarchar(max)", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Cep", - table: "Enderecos", - type: "nvarchar(max)", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs deleted file mode 100644 index 4205dbf..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241118214851_secondCreate")] - partial class secondCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.cs b/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.cs deleted file mode 100644 index 216cf8a..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class secondCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Marcas", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Marcas", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Produtos", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: false), - Descricao = table.Column(type: "nvarchar(max)", nullable: false), - Preco = table.Column(type: "nvarchar(max)", nullable: false), - IdMarca = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Produtos", x => x.Id); - table.ForeignKey( - name: "FK_Produtos_Marcas_IdMarca", - column: x => x.IdMarca, - principalTable: "Marcas", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Produtos_IdMarca", - table: "Produtos", - column: "IdMarca"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Produtos"); - - migrationBuilder.DropTable( - name: "Marcas"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs deleted file mode 100644 index 656b449..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs +++ /dev/null @@ -1,175 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241127022231_produtos")] - partial class produtos - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.cs b/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.cs deleted file mode 100644 index 6b84e63..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class produtos : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "MarcaId", - table: "Produtos", - type: "int", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Produtos_MarcaId", - table: "Produtos", - column: "MarcaId"); - - migrationBuilder.AddForeignKey( - name: "FK_Produtos_Marcas_MarcaId", - table: "Produtos", - column: "MarcaId", - principalTable: "Marcas", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Produtos_Marcas_MarcaId", - table: "Produtos"); - - migrationBuilder.DropIndex( - name: "IX_Produtos_MarcaId", - table: "Produtos"); - - migrationBuilder.DropColumn( - name: "MarcaId", - table: "Produtos"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs deleted file mode 100644 index d70bcdf..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241127171458_lista")] - partial class lista - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ProdutoId") - .HasColumnType("int"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProdutoId"); - - b.HasIndex("UsuarioId"); - - b.ToTable("ListaDeProdutosPorClientes"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.HasOne("Prova.Models.Produto", "Produto") - .WithMany() - .HasForeignKey("ProdutoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany() - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Produto"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241127171458_lista.cs b/Prova2_Henrique/Prova/Migrations/20241127171458_lista.cs deleted file mode 100644 index 63fea38..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241127171458_lista.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class lista : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ListaDeProdutosPorClientes", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UsuarioId = table.Column(type: "int", nullable: false), - ProdutoId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ListaDeProdutosPorClientes", x => x.Id); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Produtos_ProdutoId", - column: x => x.ProdutoId, - principalTable: "Produtos", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Usuarios_UsuarioId", - column: x => x.UsuarioId, - principalTable: "Usuarios", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_ProdutoId", - table: "ListaDeProdutosPorClientes", - column: "ProdutoId"); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_UsuarioId", - table: "ListaDeProdutosPorClientes", - column: "UsuarioId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ListaDeProdutosPorClientes"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs deleted file mode 100644 index 0ebf7f0..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241127193747_funcionapfv")] - partial class funcionapfv - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ProdutoId") - .HasColumnType("int"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProdutoId"); - - b.HasIndex("UsuarioId"); - - b.ToTable("ListaDeProdutosPorClientes"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.HasOne("Prova.Models.Produto", "Produto") - .WithMany() - .HasForeignKey("ProdutoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany() - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Produto"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.cs b/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.cs deleted file mode 100644 index 7e8ee82..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class funcionapfv : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs deleted file mode 100644 index a393b03..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129060230_atualizandoUsuario")] - partial class atualizandoUsuario - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Imagem") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.cs b/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.cs deleted file mode 100644 index 273f33f..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class atualizandoUsuario : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ListaDeProdutosPorClientes"); - - migrationBuilder.AddColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Imagem", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Cpf", - table: "Usuarios"); - - migrationBuilder.DropColumn( - name: "Imagem", - table: "Usuarios"); - - migrationBuilder.CreateTable( - name: "ListaDeProdutosPorClientes", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProdutoId = table.Column(type: "int", nullable: false), - UsuarioId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ListaDeProdutosPorClientes", x => x.Id); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Produtos_ProdutoId", - column: x => x.ProdutoId, - principalTable: "Produtos", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Usuarios_UsuarioId", - column: x => x.UsuarioId, - principalTable: "Usuarios", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_ProdutoId", - table: "ListaDeProdutosPorClientes", - column: "ProdutoId"); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_UsuarioId", - table: "ListaDeProdutosPorClientes", - column: "UsuarioId"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs deleted file mode 100644 index ac29dcb..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129071042_mudandoOTipoDaImagem")] - partial class mudandoOTipoDaImagem - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.cs b/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.cs deleted file mode 100644 index d59ec10..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaImagem : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Imagem", - table: "Usuarios", - newName: "ImagemUrl"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ImagemUrl", - table: "Usuarios", - newName: "Imagem"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs deleted file mode 100644 index 917efe7..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129071811_mudandoOTipoDaIamgemNovamente")] - partial class mudandoOTipoDaIamgemNovamente - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs b/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs deleted file mode 100644 index fe44e0b..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs deleted file mode 100644 index 39264b1..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129072043_mudandoOTipoDaIamgemNovamente2")] - partial class mudandoOTipoDaIamgemNovamente2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Imagem") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs b/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs deleted file mode 100644 index 6c43546..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ImagemUrl", - table: "Usuarios", - newName: "Imagem"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Imagem", - table: "Usuarios", - newName: "ImagemUrl"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs deleted file mode 100644 index b156256..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129072432_mudandoOTipoDaIamgemNovamente3")] - partial class mudandoOTipoDaIamgemNovamente3 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs b/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs deleted file mode 100644 index 42644a2..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente3 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Imagem", - table: "Usuarios", - newName: "ImagemUrl"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ImagemUrl", - table: "Usuarios", - newName: "Imagem"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs deleted file mode 100644 index d3296d3..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129073354_mudandoOTipoDaIamgemNovamente5")] - partial class mudandoOTipoDaIamgemNovamente5 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs b/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs deleted file mode 100644 index 94e283a..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente5 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ImagemUrl", - table: "Usuarios"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ImagemUrl", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs deleted file mode 100644 index 8d24c52..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129073810_mudandoOTipoDaIamgemNovamente7")] - partial class mudandoOTipoDaIamgemNovamente7 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs b/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs deleted file mode 100644 index c1df9a1..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente7 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ImagemBase64", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ImagemBase64", - table: "Usuarios"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs deleted file mode 100644 index e426755..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs +++ /dev/null @@ -1,184 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129074050_mudandoOTipoDaIamgemNovamente8")] - partial class mudandoOTipoDaIamgemNovamente8 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasMaxLength(11) - .HasColumnType("nvarchar(11)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs b/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs deleted file mode 100644 index d64ff07..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente8 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs deleted file mode 100644 index 9ebfd45..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129080256_mudandoOTipoDaIamgemNovamente10")] - partial class mudandoOTipoDaIamgemNovamente10 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs b/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs deleted file mode 100644 index 5fd21c9..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente10 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs deleted file mode 100644 index 2f07757..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129081217_mudandoOTipoDaIamgemNovamente12")] - partial class mudandoOTipoDaIamgemNovamente12 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs b/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs deleted file mode 100644 index 7857f13..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente12 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs deleted file mode 100644 index 1fc5f9a..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs +++ /dev/null @@ -1,184 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129081646_mudandoOTipoDaIamgemNovamente13")] - partial class mudandoOTipoDaIamgemNovamente13 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasMaxLength(11) - .HasColumnType("nvarchar(11)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs b/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs deleted file mode 100644 index 5605ef4..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente13 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs deleted file mode 100644 index 420e318..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129082124_mudandoOTipoDaIamgemNovamente15")] - partial class mudandoOTipoDaIamgemNovamente15 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs b/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs deleted file mode 100644 index 02bc1b0..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente15 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ImagemBase64", - table: "Usuarios"); - - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AddColumn( - name: "ImagemBase64", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs deleted file mode 100644 index af83ed1..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129083237_mudandoOTipoDaIamgemNovamente18")] - partial class mudandoOTipoDaIamgemNovamente18 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.cs b/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.cs deleted file mode 100644 index 54fb2c5..0000000 --- a/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class NomeDaMigration1221212 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129233214_euteamoluquinhas.Designer.cs similarity index 98% rename from Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs rename to Prova2_Henrique/Prova/Migrations/20241129233214_euteamoluquinhas.Designer.cs index a85bbae..51f0151 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs +++ b/Prova2_Henrique/Prova/Migrations/20241129233214_euteamoluquinhas.Designer.cs @@ -12,8 +12,8 @@ namespace Prova.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20241129173606_NomeDaMigration1221212")] - partial class NomeDaMigration1221212 + [Migration("20241129233214_euteamoluquinhas")] + partial class euteamoluquinhas { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs b/Prova2_Henrique/Prova/Migrations/20241129233214_euteamoluquinhas.cs similarity index 98% rename from Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs rename to Prova2_Henrique/Prova/Migrations/20241129233214_euteamoluquinhas.cs index 193de1f..37a76f4 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs +++ b/Prova2_Henrique/Prova/Migrations/20241129233214_euteamoluquinhas.cs @@ -6,7 +6,7 @@ namespace Prova.Migrations { /// - public partial class mudandoOTipoDaIamgemNovamente18 : Migration + public partial class euteamoluquinhas : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/Prova2_Henrique/Prova/Models/Produto.cs b/Prova2_Henrique/Prova/Models/Produto.cs index 3112d52..4a11c29 100644 --- a/Prova2_Henrique/Prova/Models/Produto.cs +++ b/Prova2_Henrique/Prova/Models/Produto.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations.Schema; diff --git a/Prova2_Henrique/Prova/Models/Usuario.cs b/Prova2_Henrique/Prova/Models/Usuario.cs index 1e813c0..d27ad05 100644 --- a/Prova2_Henrique/Prova/Models/Usuario.cs +++ b/Prova2_Henrique/Prova/Models/Usuario.cs @@ -2,7 +2,6 @@ using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; -using Swashbuckle.AspNetCore.Annotations; public class Usuario { diff --git a/Prova2_Henrique/Prova/Program.cs b/Prova2_Henrique/Prova/Program.cs index f99de1f..418d11b 100644 --- a/Prova2_Henrique/Prova/Program.cs +++ b/Prova2_Henrique/Prova/Program.cs @@ -16,27 +16,21 @@ }); }); -// Registro dos repositórios e serviços builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); -// Registro do UsuarioRepository -builder.Services.AddScoped(); // Adicionando o registro do UsuarioRepository +builder.Services.AddScoped(); -// Registro do UsuarioService -builder.Services.AddScoped(); // Registro do UsuarioService +builder.Services.AddScoped(); -// Registro do JwtTokenService -builder.Services.AddSingleton(); // Registro do JwtTokenService +builder.Services.AddSingleton(); -// Configuração do DbContext builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")) ); -// Configuração dos controllers e Swagger builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); diff --git a/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs b/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs index e7b491b..f6de0f8 100644 --- a/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs +++ b/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs @@ -1,8 +1,6 @@ using Prova.Data; using Prova.Models; using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Prova.Repositories { diff --git a/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs b/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs index 96aaed9..dc10bbd 100644 --- a/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs +++ b/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs @@ -1,8 +1,6 @@ using Prova.Data; using Prova.Models; using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Prova.Repositories { diff --git a/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs b/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs index 96e9f63..58de5a2 100644 --- a/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs +++ b/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs @@ -1,9 +1,5 @@ using Microsoft.EntityFrameworkCore; using Prova.Data; -using Prova.Models; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Prova.Repositories { @@ -21,7 +17,7 @@ public async Task> GetAllAsync() return await _context.Usuarios.ToListAsync(); } - public async Task GetByEmailAsync(string email) + public async Task GetPorEmailAssincrono(string email) { return await _context.Usuarios .Include(u => u.Enderecos) diff --git a/Prova2_Henrique/Prova/Services/MarcaService.cs b/Prova2_Henrique/Prova/Services/MarcaService.cs index 890942d..b1a9c2c 100644 --- a/Prova2_Henrique/Prova/Services/MarcaService.cs +++ b/Prova2_Henrique/Prova/Services/MarcaService.cs @@ -1,7 +1,5 @@ using Prova.Repositories; using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Prova.Services { diff --git a/Prova2_Henrique/Prova/Services/ProdutoService.cs b/Prova2_Henrique/Prova/Services/ProdutoService.cs index 8d8473d..cb16483 100644 --- a/Prova2_Henrique/Prova/Services/ProdutoService.cs +++ b/Prova2_Henrique/Prova/Services/ProdutoService.cs @@ -1,7 +1,5 @@ using Prova.Repositories; using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; namespace Prova.Services { diff --git a/Prova2_Henrique/Prova/Services/UsuarioService.cs b/Prova2_Henrique/Prova/Services/UsuarioService.cs index 455ac71..017e2bd 100644 --- a/Prova2_Henrique/Prova/Services/UsuarioService.cs +++ b/Prova2_Henrique/Prova/Services/UsuarioService.cs @@ -1,7 +1,5 @@ using Prova.Repositories; using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; using Prova.DTOs; using Prova.DTO; @@ -26,7 +24,7 @@ public async Task CriarUsuario(UsuarioCadastroDTO usuarioDto) if (!ValidarCPF(usuarioDto.Cpf)) throw new ArgumentException("CPF inválido."); - var emailExistente = await _usuarioRepository.GetByEmailAsync(usuarioDto.Email); + var emailExistente = await _usuarioRepository.GetPorEmailAssincrono(usuarioDto.Email); if (emailExistente != null) throw new InvalidOperationException("Já existe um usuário com este email."); @@ -64,7 +62,7 @@ public async Task CriarUsuario(UsuarioCadastroDTO usuarioDto) public async Task AtualizarUsuario(string email, UsuarioAtualizacaoDTO usuarioAtualizado) { - var usuarioExistente = await _usuarioRepository.GetByEmailAsync(email); + var usuarioExistente = await _usuarioRepository.GetPorEmailAssincrono(email); if (usuarioExistente == null) throw new InvalidOperationException("Usuário não encontrado."); @@ -98,7 +96,7 @@ public async Task AutenticarUsuario(string email, string senha, string if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(senha)) throw new ArgumentException("Email e senha são obrigatórios."); - var usuario = await _usuarioRepository.GetByEmailAsync(email); + var usuario = await _usuarioRepository.GetPorEmailAssincrono(email); if (usuario == null || usuario.Senha != senha) throw new InvalidOperationException("Email ou senha inválidos."); From 803aaddd954be1b8af31cb800ccb64adaf29415f Mon Sep 17 00:00:00 2001 From: Matheus Machado <126185494+mattmachad@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:51:06 -0300 Subject: [PATCH 2/2] correcao --- Prova2_Henrique/Prova/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Prova2_Henrique/Prova/Program.cs b/Prova2_Henrique/Prova/Program.cs index 257af20..76b8d1b 100644 --- a/Prova2_Henrique/Prova/Program.cs +++ b/Prova2_Henrique/Prova/Program.cs @@ -20,9 +20,9 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); -builder.Services.AddScoped(); +builder.Services.AddScoped(); -builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddSingleton(); @@ -51,4 +51,4 @@ app.UseAuthorization(); app.MapControllers(); -app.Run(); +app.Run(); \ No newline at end of file