This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace Web.Helpers | |
| { | |
| public static class AsyncHelpers | |
| { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private T DeserializeYahooRequest<T>(string response) where T : class, new() | |
| { | |
| T model = new T(); | |
| string[] parameters = response.Split('&'); | |
| foreach (var item in parameters) | |
| { | |
| var elem = item.Split('='); | |
| PropertyInfo propertyInfo = model.GetType().GetProperty(elem[0]); | |
| propertyInfo.SetValue(model, Convert.ChangeType(elem[1], propertyInfo.PropertyType), null); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IRepository<T> where T : class | |
| { | |
| IQueryable<T> All { get; } | |
| T Delete(T entity); | |
| T FindById(object Id); | |
| T Insert(T entity); | |
| T Update(T entity, T oldEntity, out bool modified); | |
| } | |
| public abstract class BaseEFRepository<TEntity> : IRepository<TEntity> where TEntity : class, new() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class LinqExtension | |
| { | |
| public static List<T> Paginate<T>(this List<T> data, Func<T, object> orderBy, int pageSize, int PageNumber) | |
| { | |
| var model = data.OrderBy(orderBy).Skip((PageNumber - 1) * pageSize).Take(pageSize).ToList(); | |
| return model; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class LinqExtension | |
| { | |
| public static int[] ConvertToArrayInt<T>(this List<T> data, Func<T,int> lamba) | |
| { | |
| return data.Select(lamba).ToArray(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface IRepository<T>{ | |
| Delete(Entity:T):T; | |
| Update(Entity:T):T; | |
| Create(Entity:T):T; | |
| } | |
| class IComprasRepository implements IRepository<ComprasModel>{ | |
| private _url:string; | |
| constructor(url:string){ | |
| this._url = url; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.post("/registro", function (req, res) { | |
| var datos = { | |
| nombre: req.body.nombre, | |
| apellido: req.body.apellido, | |
| fecha_nacimiento: req.body.fechaNacimiento, | |
| correo_electronico: req.body.email, | |
| contrasenia: req.body.password | |
| }; | |
| db.query("SELECT * FROM personas WHERE correo_electronico = ?", [req.body.email], function (err, user) { | |
| if (err) throw err; |
NewerOlder