Add MetaData Table From ExistData

Change to use MySQL
This commit is contained in:
Suphonchai Phoonsawat 2023-06-26 14:02:04 +07:00
parent 89de09d213
commit a0b3b13074
136 changed files with 3438 additions and 1237 deletions

View file

@ -29,9 +29,9 @@ namespace BMA.EHR.Application.Repositories
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
protected string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
protected string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
@ -47,6 +47,43 @@ namespace BMA.EHR.Application.Repositories
return await _dbSet.FindAsync(id);
}
public async Task<T> AddAsync(T entity)
{
//if (entity is IAuditableEntity)
//{
// (entity as IAuditableEntity).CreatedUserId = Guid.Parse(UserId);
// (entity as IAuditableEntity).CreatedUserFullName = FullName;
// (entity as IAuditableEntity).CreatedDate = DateTime.Now;
//}
await _dbSet.AddAsync(entity);
await _dbContext.SaveChangesAsync();
return entity;
}
public async Task<T> UpdateAsync(T entity)
{
//if (entity is IAuditableEntity)
//{
// (entity as IAuditableEntity).ModifiedUserId = Guid.Parse(UserId);
// (entity as IAuditableEntity).ModifiedUserFullName = FullName;
// (entity as IAuditableEntity).ModifiedDate = DateTime.Now;
//}
_dbSet.Update(entity);
await _dbContext.SaveChangesAsync();
return entity;
}
public async Task DeleteAsync(T entity)
{
_dbSet.Remove(entity);
await _dbContext.SaveChangesAsync();
}
#endregion
}
}