Add Customers in API
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 9m48s
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 9m48s
This commit is contained in:
parent
d1138d643c
commit
50014b6765
10
Core/Interfaces/IAccountTypeDom.cs
Normal file
10
Core/Interfaces/IAccountTypeDom.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using Domain.Entities;
|
||||
|
||||
namespace Core.Interfaces
|
||||
{
|
||||
public interface IAccountTypeDom
|
||||
{
|
||||
Task<IEnumerable<EAccountType>> GetAllAsync();
|
||||
Task<EAccountType?> GetByNameAsync(string name);
|
||||
}
|
||||
}
|
||||
40
Core/Services/AccountTypeService.cs
Normal file
40
Core/Services/AccountTypeService.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using Core.Interfaces;
|
||||
using Domain.Entities;
|
||||
using Models.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.Services
|
||||
{
|
||||
public class AccountTypeService : IAccountTypeDom
|
||||
{
|
||||
private readonly PhSAccountTypeRepository _contract;
|
||||
|
||||
public AccountTypeService(PhSAccountTypeRepository repository)
|
||||
{
|
||||
_contract = repository ?? throw new ArgumentNullException(nameof(repository));
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EAccountType>> GetAllAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _contract.GetAllAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var methodName = MethodBase.GetCurrentMethod()?.Name ?? "UnknownMethod";
|
||||
throw new Exception($"{methodName} Message: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public Task<EAccountType?> GetByNameAsync(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Domain/Entities/EAccountType.cs
Normal file
23
Domain/Entities/EAccountType.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Entities
|
||||
{
|
||||
public class EAccountType
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public decimal? CreditLimit { get; set; }
|
||||
|
||||
public DateTime? CreationDate { get; set; }
|
||||
|
||||
public virtual ICollection<ECustomer> Customers { get; set; } = new List<ECustomer>();
|
||||
}
|
||||
}
|
||||
37
Domain/Entities/ECustomer.cs
Normal file
37
Domain/Entities/ECustomer.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Entities
|
||||
{
|
||||
public class ECustomer
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
public string? BusinessName { get; set; }
|
||||
|
||||
public int? AccounttypesId { get; set; }
|
||||
|
||||
public int? TaxConditionId { get; set; }
|
||||
|
||||
public bool HasCreditAccount { get; set; }
|
||||
|
||||
public decimal CreditLimit { get; set; }
|
||||
|
||||
public bool Active { get; set; }
|
||||
|
||||
public string? ExternalCode { get; set; }
|
||||
|
||||
public virtual EAccountType? Accounttypes { get; set; }
|
||||
|
||||
public virtual ICollection<ECustomerAddress> ECustomerAddresses { get; set; } = new List<ECustomerAddress>();
|
||||
|
||||
public virtual ICollection<ECustomerDocument> ECustomerDocuments { get; set; } = new List<ECustomerDocument>();
|
||||
|
||||
//public virtual ICollection<PhSQuoteHeader> PhSQuoteHeaders { get; set; } = new List<PhSQuoteHeader>();
|
||||
}
|
||||
}
|
||||
42
Domain/Entities/ECustomerAddress.cs
Normal file
42
Domain/Entities/ECustomerAddress.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Entities
|
||||
{
|
||||
public class ECustomerAddress
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? CustomersId { get; set; }
|
||||
|
||||
public string? BusinessName { get; set; }
|
||||
|
||||
public string? Streetaddress1 { get; set; }
|
||||
|
||||
public string? Streetaddress2 { get; set; }
|
||||
|
||||
public string? City { get; set; }
|
||||
|
||||
public string? Stateprovince { get; set; }
|
||||
|
||||
public string? Postalcode { get; set; }
|
||||
|
||||
public string? Country { get; set; }
|
||||
|
||||
public decimal? Latitude { get; set; }
|
||||
|
||||
public decimal? Longitude { get; set; }
|
||||
|
||||
public string? Phonenumber { get; set; }
|
||||
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string? Notes { get; set; }
|
||||
|
||||
public virtual ECustomer? Customers { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
27
Domain/Entities/ECustomerDocument.cs
Normal file
27
Domain/Entities/ECustomerDocument.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Entities
|
||||
{
|
||||
public class ECustomerDocument
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int CustomersId { get; set; }
|
||||
|
||||
public int DocumenttypesId { get; set; }
|
||||
|
||||
public string DocumentNumber { get; set; } = null!;
|
||||
|
||||
public DateOnly? IssueDate { get; set; }
|
||||
|
||||
public DateOnly? ExpiryDate { get; set; }
|
||||
|
||||
public virtual ECustomer Customers { get; set; } = null!;
|
||||
|
||||
public virtual EDocumentType Documenttypes { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
21
Domain/Entities/EDocumentType.cs
Normal file
21
Domain/Entities/EDocumentType.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Entities
|
||||
{
|
||||
public class EDocumentType
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public virtual ICollection<ECustomerDocument> PhSCustomerDocuments { get; set; } = new List<ECustomerDocument>();
|
||||
}
|
||||
}
|
||||
11
Models/Interfaces/IGenericRepository.cs
Normal file
11
Models/Interfaces/IGenericRepository.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Models.Interfaces
|
||||
{
|
||||
public interface IGenericRepository<T> where T : class
|
||||
{
|
||||
Task<T?> GetByIdAsync(int id);
|
||||
Task<IEnumerable<T>> GetAllAsync();
|
||||
Task AddAsync(T entity);
|
||||
void Update(T entity);
|
||||
void Delete(T entity);
|
||||
}
|
||||
}
|
||||
8
Models/Interfaces/IPhSAccountTypeRepository.cs
Normal file
8
Models/Interfaces/IPhSAccountTypeRepository.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using Domain.Entities;
|
||||
namespace Models.Interfaces
|
||||
{
|
||||
public interface IPhSAccountTypeRepository : IGenericRepository<EAccountType>
|
||||
{
|
||||
Task<EAccountType?> GetByNameAsync(string name);
|
||||
}
|
||||
}
|
||||
13
Models/Models/PhOhTaxCondition.cs
Normal file
13
Models/Models/PhOhTaxCondition.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhOhTaxCondition
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Description { get; set; } = null!;
|
||||
|
||||
public string CmpClase { get; set; } = null!;
|
||||
}
|
||||
19
Models/Models/PhSAccountType.cs
Normal file
19
Models/Models/PhSAccountType.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSAccountType
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public decimal? CreditLimit { get; set; }
|
||||
|
||||
public DateTime? CreationDate { get; set; }
|
||||
|
||||
public virtual ICollection<PhSCustomer> PhSCustomers { get; set; } = new List<PhSCustomer>();
|
||||
}
|
||||
19
Models/Models/PhSBusinessUnit.cs
Normal file
19
Models/Models/PhSBusinessUnit.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSBusinessUnit
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? Manager { get; set; }
|
||||
|
||||
public virtual ICollection<PhSProduct> PhSProducts { get; set; } = new List<PhSProduct>();
|
||||
|
||||
public virtual ICollection<PhSQuoteHeader> PhSQuoteHeaders { get; set; } = new List<PhSQuoteHeader>();
|
||||
}
|
||||
33
Models/Models/PhSCustomer.cs
Normal file
33
Models/Models/PhSCustomer.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSCustomer
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
public string? BusinessName { get; set; }
|
||||
|
||||
public int? AccounttypesId { get; set; }
|
||||
|
||||
public int? TaxConditionId { get; set; }
|
||||
|
||||
public bool HasCreditAccount { get; set; }
|
||||
|
||||
public decimal CreditLimit { get; set; }
|
||||
|
||||
public bool Active { get; set; }
|
||||
|
||||
public string? ExternalCode { get; set; }
|
||||
|
||||
public virtual PhSAccountType? Accounttypes { get; set; }
|
||||
|
||||
public virtual ICollection<PhSCustomerAddress> PhSCustomerAddresses { get; set; } = new List<PhSCustomerAddress>();
|
||||
|
||||
public virtual ICollection<PhSCustomerDocument> PhSCustomerDocuments { get; set; } = new List<PhSCustomerDocument>();
|
||||
|
||||
public virtual ICollection<PhSQuoteHeader> PhSQuoteHeaders { get; set; } = new List<PhSQuoteHeader>();
|
||||
}
|
||||
37
Models/Models/PhSCustomerAddress.cs
Normal file
37
Models/Models/PhSCustomerAddress.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSCustomerAddress
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? CustomersId { get; set; }
|
||||
|
||||
public string? BusinessName { get; set; }
|
||||
|
||||
public string? Streetaddress1 { get; set; }
|
||||
|
||||
public string? Streetaddress2 { get; set; }
|
||||
|
||||
public string? City { get; set; }
|
||||
|
||||
public string? Stateprovince { get; set; }
|
||||
|
||||
public string? Postalcode { get; set; }
|
||||
|
||||
public string? Country { get; set; }
|
||||
|
||||
public decimal? Latitude { get; set; }
|
||||
|
||||
public decimal? Longitude { get; set; }
|
||||
|
||||
public string? Phonenumber { get; set; }
|
||||
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string? Notes { get; set; }
|
||||
|
||||
public virtual PhSCustomer? Customers { get; set; }
|
||||
}
|
||||
23
Models/Models/PhSCustomerDocument.cs
Normal file
23
Models/Models/PhSCustomerDocument.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSCustomerDocument
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int CustomersId { get; set; }
|
||||
|
||||
public int DocumenttypesId { get; set; }
|
||||
|
||||
public string DocumentNumber { get; set; } = null!;
|
||||
|
||||
public DateOnly? IssueDate { get; set; }
|
||||
|
||||
public DateOnly? ExpiryDate { get; set; }
|
||||
|
||||
public virtual PhSCustomer Customers { get; set; } = null!;
|
||||
|
||||
public virtual PhSDocumentType Documenttypes { get; set; } = null!;
|
||||
}
|
||||
17
Models/Models/PhSDocumentType.cs
Normal file
17
Models/Models/PhSDocumentType.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSDocumentType
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public virtual ICollection<PhSCustomerDocument> PhSCustomerDocuments { get; set; } = new List<PhSCustomerDocument>();
|
||||
}
|
||||
15
Models/Models/PhSProduct.cs
Normal file
15
Models/Models/PhSProduct.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSProduct
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? BusinessunitsId { get; set; }
|
||||
|
||||
public virtual PhSBusinessUnit? Businessunits { get; set; }
|
||||
|
||||
public virtual ICollection<PhSQuoteDetail> PhSQuoteDetails { get; set; } = new List<PhSQuoteDetail>();
|
||||
}
|
||||
17
Models/Models/PhSQuoteDetail.cs
Normal file
17
Models/Models/PhSQuoteDetail.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSQuoteDetail
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? QuoteheadersId { get; set; }
|
||||
|
||||
public int? ProductsId { get; set; }
|
||||
|
||||
public virtual PhSProduct? Products { get; set; }
|
||||
|
||||
public virtual PhSQuoteHeader? Quoteheaders { get; set; }
|
||||
}
|
||||
21
Models/Models/PhSQuoteHeader.cs
Normal file
21
Models/Models/PhSQuoteHeader.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Models.Models;
|
||||
|
||||
public partial class PhSQuoteHeader
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? TicketId { get; set; }
|
||||
|
||||
public int? BusinessunitsId { get; set; }
|
||||
|
||||
public int? CustomersId { get; set; }
|
||||
|
||||
public virtual PhSBusinessUnit? Businessunits { get; set; }
|
||||
|
||||
public virtual PhSCustomer? Customers { get; set; }
|
||||
|
||||
public virtual ICollection<PhSQuoteDetail> PhSQuoteDetails { get; set; } = new List<PhSQuoteDetail>();
|
||||
}
|
||||
@ -15,26 +15,61 @@ public partial class PhronCareOperationsHubContext : DbContext
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<PhOhTaxCondition> PhOhTaxConditions { get; set; }
|
||||
|
||||
public virtual DbSet<PhOhTicket> PhOhTickets { get; set; }
|
||||
|
||||
public virtual DbSet<PhSAccountType> PhSAccountTypes { get; set; }
|
||||
|
||||
public virtual DbSet<PhSBusinessUnit> PhSBusinessUnits { get; set; }
|
||||
|
||||
public virtual DbSet<PhSCustomer> PhSCustomers { get; set; }
|
||||
|
||||
public virtual DbSet<PhSCustomerAddress> PhSCustomerAddresses { get; set; }
|
||||
|
||||
public virtual DbSet<PhSCustomerDocument> PhSCustomerDocuments { get; set; }
|
||||
|
||||
public virtual DbSet<PhSDocumentType> PhSDocumentTypes { get; set; }
|
||||
|
||||
public virtual DbSet<PhSProduct> PhSProducts { get; set; }
|
||||
|
||||
public virtual DbSet<PhSQuoteDetail> PhSQuoteDetails { get; set; }
|
||||
|
||||
public virtual DbSet<PhSQuoteHeader> PhSQuoteHeaders { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
#region VERSION DOCKER
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
// Dejarlo vacío para usar la configuración externa desde Program.cs o Startup.cs
|
||||
}
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
// Dejarlo vacío para usar la configuración externa desde Program.cs o Startup.cs
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
// => optionsBuilder.UseSqlServer("Server=ROG-\\SQLEXPRESS;Database=phronCare_OperationsHub;Integrated Security=True;TrustServerCertificate=True;MultipleActiveResultSets=True;");
|
||||
// => optionsBuilder.UseSqlServer("data source=srv01.saludlab.com.ar,39458;initial catalog=phronCare_OperationsHub;User ID=sa;Password=HS|s[~xxQzTo/n>9jO;encrypt=False;trustServerCertificate=True;MultipleActiveResultSets=True");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.UseCollation("Modern_Spanish_CI_AS");
|
||||
|
||||
modelBuilder.Entity<PhOhTaxCondition>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__PhOH_Tax__3213E83F26F7EAEF");
|
||||
|
||||
entity.ToTable("PhOH_Tax_Conditions");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.CmpClase)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnName("cmp_clase");
|
||||
entity.Property(e => e.Description)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("description");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhOhTicket>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.TicketId).HasName("PK__PhOH_Tic__712CC607C3A58A28");
|
||||
entity.HasKey(e => e.TicketId).HasName("PK__PhOH_Tic__712CC607E630F981");
|
||||
|
||||
entity.ToTable("PhOH_Tickets");
|
||||
|
||||
@ -53,6 +88,219 @@ public partial class PhronCareOperationsHubContext : DbContext
|
||||
entity.Property(e => e.Urgencia).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSAccountType>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_AccountTypes");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.CreationDate)
|
||||
.HasDefaultValueSql("(getdate())")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("creation_date");
|
||||
entity.Property(e => e.CreditLimit)
|
||||
.HasColumnType("decimal(18, 2)")
|
||||
.HasColumnName("credit_limit");
|
||||
entity.Property(e => e.Description)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("description");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSBusinessUnit>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_BusinessUnits");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Description)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("description");
|
||||
entity.Property(e => e.Manager)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("manager");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSCustomer>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_Customers");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.AccounttypesId).HasColumnName("accounttypes_id");
|
||||
entity.Property(e => e.Active).HasColumnName("active");
|
||||
entity.Property(e => e.BusinessName)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("business_name");
|
||||
entity.Property(e => e.CreditLimit)
|
||||
.HasColumnType("decimal(18, 2)")
|
||||
.HasColumnName("credit_limit");
|
||||
entity.Property(e => e.ExternalCode)
|
||||
.HasMaxLength(10)
|
||||
.IsFixedLength()
|
||||
.HasColumnName("external_code");
|
||||
entity.Property(e => e.HasCreditAccount).HasColumnName("has_credit_account");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("name");
|
||||
entity.Property(e => e.TaxConditionId).HasColumnName("tax_condition_id");
|
||||
|
||||
entity.HasOne(d => d.Accounttypes).WithMany(p => p.PhSCustomers)
|
||||
.HasForeignKey(d => d.AccounttypesId)
|
||||
.HasConstraintName("FK_PhS_Customers_PhS_AccountTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSCustomerAddress>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_CustomerAddress");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.BusinessName)
|
||||
.HasMaxLength(100)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("business_name");
|
||||
entity.Property(e => e.City)
|
||||
.HasMaxLength(100)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("city");
|
||||
entity.Property(e => e.Country)
|
||||
.HasMaxLength(100)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("country");
|
||||
entity.Property(e => e.CustomersId).HasColumnName("customers_id");
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(100)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("email");
|
||||
entity.Property(e => e.Latitude)
|
||||
.HasColumnType("decimal(9, 6)")
|
||||
.HasColumnName("latitude");
|
||||
entity.Property(e => e.Longitude)
|
||||
.HasColumnType("decimal(9, 6)")
|
||||
.HasColumnName("longitude");
|
||||
entity.Property(e => e.Notes)
|
||||
.HasMaxLength(255)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("notes");
|
||||
entity.Property(e => e.Phonenumber)
|
||||
.HasMaxLength(25)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("phonenumber");
|
||||
entity.Property(e => e.Postalcode)
|
||||
.HasMaxLength(20)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("postalcode");
|
||||
entity.Property(e => e.Stateprovince)
|
||||
.HasMaxLength(100)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("stateprovince");
|
||||
entity.Property(e => e.Streetaddress1)
|
||||
.HasMaxLength(255)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("streetaddress1");
|
||||
entity.Property(e => e.Streetaddress2)
|
||||
.HasMaxLength(255)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("streetaddress2");
|
||||
|
||||
entity.HasOne(d => d.Customers).WithMany(p => p.PhSCustomerAddresses)
|
||||
.HasForeignKey(d => d.CustomersId)
|
||||
.HasConstraintName("FK_PhS_CustomerAddress_PhS_Customers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSCustomerDocument>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__PhS_Cust__3213E83F32E80850");
|
||||
|
||||
entity.ToTable("PhS_CustomerDocuments");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.CustomersId).HasColumnName("customers_id");
|
||||
entity.Property(e => e.DocumentNumber)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("document_number");
|
||||
entity.Property(e => e.DocumenttypesId).HasColumnName("documenttypes_id");
|
||||
entity.Property(e => e.ExpiryDate).HasColumnName("expiry_date");
|
||||
entity.Property(e => e.IssueDate).HasColumnName("issue_date");
|
||||
|
||||
entity.HasOne(d => d.Customers).WithMany(p => p.PhSCustomerDocuments)
|
||||
.HasForeignKey(d => d.CustomersId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK__PhS_Custo__custo__6754599E");
|
||||
|
||||
entity.HasOne(d => d.Documenttypes).WithMany(p => p.PhSCustomerDocuments)
|
||||
.HasForeignKey(d => d.DocumenttypesId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_PhS_CustomerDocuments_PhS_DocumentTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSDocumentType>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_DocumentTypes");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Code)
|
||||
.HasMaxLength(4)
|
||||
.HasColumnName("code");
|
||||
entity.Property(e => e.Description)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("description");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSProduct>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_Products");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.BusinessunitsId).HasColumnName("businessunits_id");
|
||||
|
||||
entity.HasOne(d => d.Businessunits).WithMany(p => p.PhSProducts)
|
||||
.HasForeignKey(d => d.BusinessunitsId)
|
||||
.HasConstraintName("FK_PhS_Products_PhS_BusinessUnits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSQuoteDetail>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_QuoteDetails");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.ProductsId).HasColumnName("products_id");
|
||||
entity.Property(e => e.QuoteheadersId).HasColumnName("quoteheaders_id");
|
||||
|
||||
entity.HasOne(d => d.Products).WithMany(p => p.PhSQuoteDetails)
|
||||
.HasForeignKey(d => d.ProductsId)
|
||||
.HasConstraintName("FK_PhS_QuoteDetails_PhS_Products");
|
||||
|
||||
entity.HasOne(d => d.Quoteheaders).WithMany(p => p.PhSQuoteDetails)
|
||||
.HasForeignKey(d => d.QuoteheadersId)
|
||||
.HasConstraintName("FK_PhS_QuoteDetails_PhS_QuoteHeaders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PhSQuoteHeader>(entity =>
|
||||
{
|
||||
entity.ToTable("PhS_QuoteHeaders");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.BusinessunitsId).HasColumnName("businessunits_id");
|
||||
entity.Property(e => e.CustomersId).HasColumnName("customers_id");
|
||||
entity.Property(e => e.TicketId)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("ticket_id");
|
||||
|
||||
entity.HasOne(d => d.Businessunits).WithMany(p => p.PhSQuoteHeaders)
|
||||
.HasForeignKey(d => d.BusinessunitsId)
|
||||
.HasConstraintName("FK_PhS_QuoteHeaders_PhS_BusinessUnits");
|
||||
|
||||
entity.HasOne(d => d.Customers).WithMany(p => p.PhSQuoteHeaders)
|
||||
.HasForeignKey(d => d.CustomersId)
|
||||
.HasConstraintName("FK_PhS_QuoteHeaders_PhS_Customers");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
|
||||
43
Models/Repositories/GenericRepository.cs
Normal file
43
Models/Repositories/GenericRepository.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models.Interfaces;
|
||||
|
||||
namespace Models.Repositories
|
||||
{
|
||||
public class GenericRepository<T> : IGenericRepository<T> where T : class
|
||||
{
|
||||
private readonly DbContext _context;
|
||||
private readonly DbSet<T> _dbSet;
|
||||
|
||||
public GenericRepository(DbContext context)
|
||||
{
|
||||
_context = context;
|
||||
_dbSet = context.Set<T>();
|
||||
}
|
||||
|
||||
public async Task<T?> GetByIdAsync(int id)
|
||||
{
|
||||
return await _dbSet.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<T>> GetAllAsync()
|
||||
{
|
||||
return await _dbSet.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(T entity)
|
||||
{
|
||||
await _dbSet.AddAsync(entity);
|
||||
}
|
||||
|
||||
public void Update(T entity)
|
||||
{
|
||||
_dbSet.Update(entity);
|
||||
}
|
||||
|
||||
public void Delete(T entity)
|
||||
{
|
||||
_dbSet.Remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
23
Models/Repositories/PhSAccountTypeRepository.cs
Normal file
23
Models/Repositories/PhSAccountTypeRepository.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models.Interfaces;
|
||||
using Models.Models;
|
||||
|
||||
namespace Models.Repositories
|
||||
{
|
||||
public class PhSAccountTypeRepository : GenericRepository<EAccountType>, IPhSAccountTypeRepository
|
||||
{
|
||||
private readonly DbContext _context;
|
||||
|
||||
public PhSAccountTypeRepository(DbContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<EAccountType?> GetByNameAsync(string name)
|
||||
{
|
||||
return await _context.Set<EAccountType>()
|
||||
.FirstOrDefaultAsync(a => a.Name == name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
public class RequestLoggingMiddleware : IMiddleware
|
||||
{
|
||||
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
||||
{
|
||||
// Captura información de la solicitud antes de que se procese la autenticación
|
||||
var request = context.Request;
|
||||
var requestInfo = $"{request.Method} {request.Path}{request.QueryString}";
|
||||
Console.Clear();
|
||||
// Registra la información en la consola o en tu sistema de registro
|
||||
Console.WriteLine($"METODO SOLICITUD ENTRANTE: {requestInfo}");
|
||||
Console.WriteLine($"PATH SOLICITUD ENTRANTE: {requestInfo}");
|
||||
Console.WriteLine($"QUERY STRING ENTRANTE: {requestInfo}");
|
||||
|
||||
await next(context);
|
||||
}
|
||||
}
|
||||
19
phronCare.API/Controllers/RequestLoggingMiddleware.cs
Normal file
19
phronCare.API/Controllers/RequestLoggingMiddleware.cs
Normal file
@ -0,0 +1,19 @@
|
||||
//using System.Threading.Tasks;
|
||||
//using Microsoft.AspNetCore.Http;
|
||||
|
||||
//public class RequestLoggingMiddleware : IMiddleware
|
||||
//{
|
||||
// public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
||||
// {
|
||||
// // Captura información de la solicitud antes de que se procese la autenticación
|
||||
// var request = context.Request;
|
||||
// var requestInfo = $"{request.Method} {request.Path}{request.QueryString}";
|
||||
// Console.Clear();
|
||||
// // Registra la información en la consola o en tu sistema de registro
|
||||
// Console.WriteLine($"METODO SOLICITUD ENTRANTE: {requestInfo}");
|
||||
// Console.WriteLine($"PATH SOLICITUD ENTRANTE: {requestInfo}");
|
||||
// Console.WriteLine($"QUERY STRING ENTRANTE: {requestInfo}");
|
||||
|
||||
// await next(context);
|
||||
// }
|
||||
//}
|
||||
31
phronCare.API/Controllers/Sales/AccountTypeController.cs
Normal file
31
phronCare.API/Controllers/Sales/AccountTypeController.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Core.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace phronCare.API.Controllers.Sales
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AccountTypeController : ControllerBase
|
||||
{
|
||||
private readonly IAccountTypeDom _accountTypeService;
|
||||
|
||||
// Constructor que acepta ITicketDom como parámetro
|
||||
public AccountTypeController(IAccountTypeDom accountTypeService)
|
||||
{
|
||||
_accountTypeService = accountTypeService ?? throw new ArgumentNullException(nameof(accountTypeService));
|
||||
}
|
||||
[HttpGet("GetAll")]
|
||||
public async Task<IActionResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await _accountTypeService.GetAllAsync();
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28,9 +28,13 @@ var configuration = builder.Configuration;
|
||||
builder.Services.AddDbContext<phronCareDbContext>(options => options.UseSqlServer(configuration.GetConnectionString("phronCareDB"))); // DB Seguridad
|
||||
builder.Services.AddDbContext<PhronCareOperationsHubContext>(options =>
|
||||
options.UseSqlServer(configuration.GetConnectionString("PhronCareOperationsHubConnection"))); // DB Operacional
|
||||
#endregion
|
||||
|
||||
#region Repositorios y Servicios
|
||||
builder.Services.AddScoped<ITicketRepository, TicketRepository>();
|
||||
builder.Services.AddScoped<ITicketDom, TicketService>();
|
||||
builder.Services.AddScoped<ITicketDom, TicketService>();
|
||||
builder.Services.AddScoped<IPhSAccountTypeRepository, PhSAccountTypeRepository>();
|
||||
builder.Services.AddScoped<IAccountTypeDom, AccountTypeService>();
|
||||
#endregion
|
||||
|
||||
#region Require Confirmed Email
|
||||
|
||||
@ -5,5 +5,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>phronCare API</ActiveDebugProfile>
|
||||
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user