Skip to content

Instantly share code, notes, and snippets.

View Whistler092's full-sized avatar

Ramiro Andrés Bedoya E. Whistler092

View GitHub Profile
@Whistler092
Whistler092 / ActoresController.cs
Last active May 20, 2021 11:14
Upload files into Azure Blob Storage
using System;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using API.DTOs;
using API.Entidades;
using API.Utilidades;
namespace API.Controllers
{
@Whistler092
Whistler092 / GenerosController.cs
Last active May 13, 2021 04:11
Config Pagination
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using API.DTOs;
using API.Entidades;
@Whistler092
Whistler092 / ApiController.cs
Last active May 9, 2021 05:45
Configurar AutoMapper
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using peliculasAPI.DTOs;
using peliculasAPI.Entidades;
@Whistler092
Whistler092 / BehaviorBadRequests.cs
Last active May 9, 2021 05:24
Filter with BadRequest
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace API.ApiBehavior
{
public static class BehaviorBadRequests
{
public static void Parsear(ApiBehaviorOptions options)
{
@Whistler092
Whistler092 / ApplicationDbContext.cs
Created May 8, 2021 20:53
Add EF with SqlServer
using System;
using Microsoft.EntityFrameworkCore;
using peliculasAPI.Entidades;
namespace API
{
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(DbContextOptions options) : base(options)
{
@Whistler092
Whistler092 / Startup.cs
Created May 8, 2021 19:46
Add Cors Dotnet core
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<MyActionFilter>();
services.AddControllers(options =>
@Whistler092
Whistler092 / ApiController.cs
Created May 8, 2021 17:10
Action Filter y ExceptionFilter
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
@Whistler092
Whistler092 / Genero.cs
Last active May 5, 2021 20:11
Validaciones personalizadas
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using API.Entidades.Validaciones;
namespace API.Entidades
{
public class Genero : IValidatableObject
{
public int Id { get; set; }