This commit is contained in:
mmrbnjd
2024-04-29 18:15:46 +03:30
parent 7b8127dc72
commit 319270d567
20 changed files with 356 additions and 96 deletions

View File

@@ -100,11 +100,59 @@ namespace Back.Services
}
}
public async Task<bool> ExistMobileAndCompanyIsActive(string mobile)
public async Task<bool> AddORUpdateCompanyBoolResult(Company item)
{
return await _repoCompany.GetAll().AnyAsync(w => w.Mobile == mobile && w.IsActive);
try
{
//SysLog log = new SysLog()
//{
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/AddORUpdateCompany",
// Value = "*" + JsonConvert.SerializeObject(item),
// Route = _httpContextAccessor.HttpContext.Request.Path,
// Type = "User"
//};
//_contextMongodb.InsertItem(log);
if (item.ID == null || item.ID == 0)
{
return await _repoCompany.AddBoolResultAsync(item);
}
else
{
return await _repoCompany.UpdateAsync(item);
}
}
catch (Exception ex)
{
//SysLog log = new SysLog()
//{
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
// Datetime = DateTime.Now.ConvertMiladiToShamsi(),
// Method = $"{_httpContextAccessor.HttpContext.Request.Method}/{this.GetType().FullName}/AddORUpdateCompany",
// Value = ex.Message,
// Route = _httpContextAccessor.HttpContext.Request.Path,
// Type = "catch"
//};
//_contextMongodb.InsertItem(log);
return false;
}
}
public async Task<bool> ExistMobileInCompany(string mobile,bool IsActive=true)
{
var resquest= _repoCompany.GetAll().Where(w => w.Mobile == mobile );
if (IsActive)
resquest = resquest.Where(w => w.IsActive);
return await resquest.AnyAsync();
}