Update 20211218

This commit is contained in:
2021-12-18 10:02:42 +01:00
parent 1254540139
commit 3ef1971def
842 changed files with 199916 additions and 17112 deletions

View File

@@ -0,0 +1,52 @@
using APP.Utils;
using BWPMModels;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
namespace APP.Dal
{
public class AccountDAL : IAccountDAL
{
private IDbHelper _db;
public AccountDAL(IDbHelper db)
{
this._db = db;
}
public async Task<UserModel> GetById(int id)
{
try
{
string sp = "Employee_GetById";
List<SqlParameter> parms = new List<SqlParameter>();
parms.Add(new SqlParameter("Id", id));
var data = await _db.ExecuteToTableAsync<UserModel>(sp, parms, DbHelperEnum.StoredProcedure);
return data != null ? data.FirstOrDefault() : null;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
public async Task<UserModel> GetByEmail(string email)
{
try
{
string sp = "Employee_GetByEmail";
List<SqlParameter> parms = new List<SqlParameter>();
parms.Add(new SqlParameter("Email", email));
var data = await _db.ExecuteToTableAsync<UserModel>(sp, parms, DbHelperEnum.StoredProcedure);
return data != null ? data.FirstOrDefault() : null;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
}