Add Customers in API
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 9m48s

This commit is contained in:
Leandro Hernan Rojas 2025-04-03 15:49:04 -03:00
parent d1138d643c
commit 50014b6765
195 changed files with 810 additions and 26 deletions

View File

@ -0,0 +1,10 @@
using Domain.Entities;
namespace Core.Interfaces
{
public interface IAccountTypeDom
{
Task<IEnumerable<EAccountType>> GetAllAsync();
Task<EAccountType?> GetByNameAsync(string name);
}
}

View 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();
}
}
}

View 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>();
}
}

View 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>();
}
}

View 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; }
}
}

View 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!;
}
}

View 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>();
}
}

View 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);
}
}

View File

@ -0,0 +1,8 @@
using Domain.Entities;
namespace Models.Interfaces
{
public interface IPhSAccountTypeRepository : IGenericRepository<EAccountType>
{
Task<EAccountType?> GetByNameAsync(string name);
}
}

View 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!;
}

View 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>();
}

View 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>();
}

View 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>();
}

View 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; }
}

View 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!;
}

View 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>();
}

View 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>();
}

View 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; }
}

View 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>();
}

View File

@ -15,8 +15,28 @@ public partial class PhronCareOperationsHubContext : DbContext
{ {
} }
public virtual DbSet<PhOhTaxCondition> PhOhTaxConditions { get; set; }
public virtual DbSet<PhOhTicket> PhOhTickets { 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) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#region VERSION DOCKER #region VERSION DOCKER
{ {
@ -26,15 +46,30 @@ public partial class PhronCareOperationsHubContext : DbContext
} }
} }
#endregion #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) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
modelBuilder.UseCollation("Modern_Spanish_CI_AS"); 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 => 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"); entity.ToTable("PhOH_Tickets");
@ -53,6 +88,219 @@ public partial class PhronCareOperationsHubContext : DbContext
entity.Property(e => e.Urgencia).HasMaxLength(50); 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); OnModelCreatingPartial(modelBuilder);
} }

View 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);
}
}
}

View 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);
}
}
}

View File

@ -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);
}
}

View 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);
// }
//}

View 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);
}
}
}
}

View File

@ -28,9 +28,13 @@ var configuration = builder.Configuration;
builder.Services.AddDbContext<phronCareDbContext>(options => options.UseSqlServer(configuration.GetConnectionString("phronCareDB"))); // DB Seguridad builder.Services.AddDbContext<phronCareDbContext>(options => options.UseSqlServer(configuration.GetConnectionString("phronCareDB"))); // DB Seguridad
builder.Services.AddDbContext<PhronCareOperationsHubContext>(options => builder.Services.AddDbContext<PhronCareOperationsHubContext>(options =>
options.UseSqlServer(configuration.GetConnectionString("PhronCareOperationsHubConnection"))); // DB Operacional options.UseSqlServer(configuration.GetConnectionString("PhronCareOperationsHubConnection"))); // DB Operacional
#endregion
#region Repositorios y Servicios
builder.Services.AddScoped<ITicketRepository, TicketRepository>(); 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 #endregion
#region Require Confirmed Email #region Require Confirmed Email

View File

@ -5,5 +5,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ActiveDebugProfile>phronCare API</ActiveDebugProfile> <ActiveDebugProfile>phronCare API</ActiveDebugProfile>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

Some files were not shown because too many files have changed in this diff Show More