...
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user