Skip to content

Instantly share code, notes, and snippets.

View fredyfx's full-sized avatar
💭
With all the power 2.0!

Fredy R. Guibert フレディ fredyfx

💭
With all the power 2.0!
View GitHub Profile
@fredyfx
fredyfx / Startup.cs
Created December 25, 2018 00:16
Agregando DbContext a los servicios de nuestr app.
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<AdvientoContext>();
services.AddMvc();
}
@fredyfx
fredyfx / AdvientoContext.cs
Created December 24, 2018 23:54
Agregando el contexto para la conexión a la base de datos con Entity Framework Core
using Microsoft.EntityFrameworkCore;
using AdvientoCSharpDic2018.Models;
namespace AdvientoCSharpDic2018
{
public class AdvientoContext : DbContext
{
public DbSet<Producto> Productos {get;set;}
}
}
@fredyfx
fredyfx / producto.cs
Created December 24, 2018 23:43
Agregando un modelo a la aplicación web.
using System;
namespace AdvientoCSharpDic2018.Models{
public class Producto {
public int Id {get;set;}
public string Nombre {get;set;}
public int Stock {get;set;}
public bool TieneOferta {get;set;}
public DateTime CreadoEn {get;set;}
public DateTime ActualizadoEn {get;set;}
@fredyfx
fredyfx / startup.cs
Created December 24, 2018 08:03
Agregamos el routing by default
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseMvc(config=>{
@fredyfx
fredyfx / startup.cs
Created December 24, 2018 07:47
Agregando el servicio de MVC
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
@fredyfx
fredyfx / HomeController.cs
Created December 24, 2018 07:23
El controlador Home
using Microsoft.AspNetCore.Mvc;
namespace AdvientoCSharpDic2018.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public IActionResult Index()
@fredyfx
fredyfx / startup.cs
Created December 24, 2018 06:34
eliminando las 3 líneas que generan el Hello World
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace AdvientoCSharpDic2018
@fredyfx
fredyfx / index.html
Created December 24, 2018 06:31
primer archivo html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<p>lo que queramos</p>
</div>
</body>
</html>
@fredyfx
fredyfx / Startup.cs
Created December 24, 2018 05:58
Primer Startup.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace AdvientoCSharpDic2018
@fredyfx
fredyfx / vue-bind-style.js;
Created October 4, 2018 23:54
How to bind style on condition for Vue-js
v-bind:style="[ errors.has('fieldHTMLElementName') ? {'color': '#f13347'} : {'color': '#000'} ]"