Skip to content

Instantly share code, notes, and snippets.

View rolando-r's full-sized avatar
πŸŽ†
Learning

Rolando Rodriguez rolando-r

πŸŽ†
Learning
View GitHub Profile
// Consultas
public async Task<IEnumerable<Empleado>> EmpleadoConMenosDe5Ventas()
{
var fechaInicial = new DateTime(2023, 1, 1);
var fechaFinal = new DateTime(2023, 12, 31);
var empleadosConMenosDe5Ventas = await _context.Empleados
.Where(e => e.Ventas
.Count(v => v.FechaVenta >= fechaInicial && v.FechaVenta <= fechaFinal) < 5)
//Controllers:
[HttpGet("GetAllProveedorConMedicamentoMenos50U")]
//[Authorize(Roles="")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult<IEnumerable<ProveedorDto>>> GetAllProveedorConMedicamentoMenos50U()
{
IEnumerable<Proveedor> Proveedores = await _unitOfWork.Proveedores.ProveedoresMedicamentos();
AspNetCoreRateLimit
AutoMapper.Extensions.Microsoft.DependencyInjection
Microsoft.AspNetCore.Hosting
Microsoft.Extensions.Hosting
Microsoft.AspNetCore.Mvc.Versioning
// API
Controllers
Dtos
Extensions
Helpers
Profiles
Services
// Aplicacion
Repository
@rolando-r
rolando-r / gist:f409b98edc7eb366073745dd373b9dd0
Created September 11, 2023 13:30
GenericContext/Persistencia
// IncidenciasContext
using System.Reflection;
using Dominio;
using Microsoft.EntityFrameworkCore;
namespace Persistencia
{
public class IncidenciasContext : DbContext
{
public IncidenciasContext(DbContextOptions<IncidenciasContext> options) : base(options)
// AreaConfiguration
using Dominio;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Infrastructure.Data.Configuration;
public class AreaConfiguration : IEntityTypeConfiguration<Area>
{
public void Configure(EntityTypeBuilder<Area> builder)
// AreaRepository
namespace Dominio.Interfaces;
public interface IAreaRepository : IGenericRepositoryB<Area>
{
}
///////////////////////////////////////////////////////////////////////////////////////
@rolando-r
rolando-r / gist:d0461f37a7b848e8923620874f277085
Created September 11, 2023 13:21
UnitOfWork/Aplicacion
// UnitOfWork
using Aplicacion.Repository;
using Dominio;
using Dominio.Interfaces;
using Persistencia;
namespace Aplicacion.UnitOfWork
{
public class UnitOfWork : IUnitOfWork, IDisposable
{
@rolando-r
rolando-r / gist:51770182426c3c9b0cb1e91b1c0e1a86
Created September 11, 2023 13:15
Repository/Aplicacion
//AreaRepository
using Dominio;
using Dominio.Interfaces;
using Microsoft.EntityFrameworkCore;
using Persistencia;
namespace Aplicacion.Repository
{
public class AreaRepository : GenericRepositoryB<Area>, IAreaRepository
using System.Reflection;
using System.Text;
using ApiIncidencias.Extensions;
using AspNetCoreRateLimit;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Persistencia;
var builder = WebApplication.CreateBuilder(args);