using Microsoft.EntityFrameworkCore; using Models.Interfaces; using Models.Models; namespace PhronCare.Core.Data.Repositories.Sales { public class PhSFormSeriesRepository(PhronCareOperationsHubContext context) : IPhSFormSeriesRepository { #region Declaraciones private readonly PhronCareOperationsHubContext _context = context; #endregion #region Métodos public async Task GetNextInternalNumberAsync(int formSeriesId) { var nextNumberParam = new Microsoft.Data.SqlClient.SqlParameter { ParameterName = "@NextNumber", SqlDbType = System.Data.SqlDbType.Int, Direction = System.Data.ParameterDirection.Output }; await _context.Database.ExecuteSqlRawAsync( "EXEC dbo.PhS_FormSeries_GetNextNumber @FormSeriesId = {0}, @NextNumber = @NextNumber OUTPUT", formSeriesId, nextNumberParam ); return (int)nextNumberParam.Value; } #endregion } }