Skip to content

Instantly share code, notes, and snippets.

View azaharafernandezguizan's full-sized avatar

Azahara Fernández Guizán azaharafernandezguizan

View GitHub Profile
@azaharafernandezguizan
azaharafernandezguizan / InfoController.cs
Created December 30, 2018 17:15
Example of Web API Controller on NetCore
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MyDTOs;
using MyManager;
using Microsoft.AspNetCore.Mvc;
namespace MyApp.Controllers
{
@azaharafernandezguizan
azaharafernandezguizan / IInfoManager.cs
Created December 30, 2018 17:12
Example of manager interface on NetCore
using MyDBContext.Models;
using MyDTOs;
using System;
using System.Collections.Generic;
using System.Text;
namespace MyManager
{
public interface IInfoManager
{
@azaharafernandezguizan
azaharafernandezguizan / InfoManager.cs
Created December 30, 2018 17:09
Example of manager implementation on NetCore
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyBusinessLogic;
using MyDBContext.Models;
using MyDTOs;
namespace MyManager
{
@azaharafernandezguizan
azaharafernandezguizan / Recursos.cs
Last active December 30, 2018 17:11
DTO example on NetCore
using System;
using System.Collections.Generic;
using System.Text;
namespace MyDTOs
{
public class RecursosInfo
{
public int RecursoID { get; set; }
public string Nombre { get; set; }
@azaharafernandezguizan
azaharafernandezguizan / RecursosRepository.cs
Created December 30, 2018 17:04
Repository implementation on NetCore
using System;
using System.Collections.Generic;
using System.Linq;
using MyDBContext.Models;
using Microsoft.EntityFrameworkCore;
namespace MicrobiologiaBusinessLogic
{
public class RecursosRepository : IRecursosRepository, IDisposable
{
@azaharafernandezguizan
azaharafernandezguizan / IRecursosRepository.cs
Created December 30, 2018 17:01
Repository Interface on NetCore
using MyDBContext.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace MyBusinessLogic
{
public interface IRecursosRepository: IDisposable
{
void InsertRecurso(Recursos recurso);
@azaharafernandezguizan
azaharafernandezguizan / Context.cs
Created December 30, 2018 17:00
OnConfiguring Context method from NetCore
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
IConfigurationRoot configuration = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json")
.Build();
optionsBuilder.UseMySql(configuration.GetConnectionString("MicrobiologiaDatabase"));
@azaharafernandezguizan
azaharafernandezguizan / appsetings.json
Created December 30, 2018 16:57
App Setting file in Net Core
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
@azaharafernandezguizan
azaharafernandezguizan / students.component.ts
Created December 21, 2018 11:25
Angular sorting (methods in TypeScript file)
sortTable(prop: string) {
this.path = prop.split('.');
this.order = this.order * (-1); 
return false; 
 }
getIcon(prop:string): string{
//Yo uso iconos font-awesome de ahí la nomenclatura
var iconClass = "fa fa-sort";
@azaharafernandezguizan
azaharafernandezguizan / students.component.html
Created December 21, 2018 11:18
Angular table with pagination and sorting.
<div>
<ul>
<li (click) = "sortTable('name')">
nombre
<i [class]="getIcon('name')" aria-hidden="true"></i>
</li>
<li (click) = "sortTable('lastname')">
apellidos
<i [class]="getIcon('lastname')" aria-hidden="true"></i>
</li>