Skip to content

Commit

Permalink
fixed service : dal. -> base.
Browse files Browse the repository at this point in the history
  • Loading branch information
anjoy8 committed Mar 25, 2019
1 parent ca80439 commit 10ccc47
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 deletions Blog.Core.Services/AdvertisementServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,30 @@ public void ReturnExp()
//public IAdvertisementRepository dal = new AdvertisementRepository();
//public int Sum(int i, int j)
//{
// return dal.Sum(i, j);
// return base.Sum(i, j);

//}


//public int Add(Advertisement model)
//{
// return dal.Add(model);
// return base.Add(model);
//}

//public bool Delete(Advertisement model)
//{
// return dal.Delete(model);
// return base.Delete(model);
//}

//public List<Advertisement> Query(Expression<Func<Advertisement, bool>> whereExpression)
//{
// return dal.Query(whereExpression);
// return base.Query(whereExpression);

//}

//public bool Update(Advertisement model)
//{
// return dal.Update(model);
// return base.Update(model);
//}

}
Expand Down
8 changes: 4 additions & 4 deletions Blog.Core.Services/BlogArticleServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public BlogArticleServices(IBlogArticleRepository dal, IMapper IMapper)
/// <returns></returns>
public async Task<BlogViewModels> getBlogDetails(int id)
{
var bloglist = await dal.Query(a => a.bID > 0, a => a.bID);
var blogArticle = (await dal.Query(a => a.bID == id)).FirstOrDefault();
var bloglist = await base.Query(a => a.bID > 0, a => a.bID);
var blogArticle = (await base.Query(a => a.bID == id)).FirstOrDefault();

BlogViewModels models = null;

Expand Down Expand Up @@ -71,7 +71,7 @@ public async Task<BlogViewModels> getBlogDetails(int id)


blogArticle.btraffic += 1;
await dal.Update(blogArticle, new List<string> { "btraffic" });
await base.Update(blogArticle, new List<string> { "btraffic" });
}

return models;
Expand All @@ -87,7 +87,7 @@ public async Task<BlogViewModels> getBlogDetails(int id)
[Caching(AbsoluteExpiration = 10)]
public async Task<List<BlogArticle>> getBlogs()
{
var bloglist = await dal.Query(a => a.bID > 0, a => a.bID);
var bloglist = await base.Query(a => a.bID > 0, a => a.bID);

return bloglist;

Expand Down
2 changes: 1 addition & 1 deletion Blog.Core.Services/RoleModulePermissionServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public RoleModulePermissionServices(IRoleModulePermissionRepository dal, IModule
[Caching(AbsoluteExpiration = 10)]
public async Task<List<RoleModulePermission>> GetRoleModule()
{
var roleModulePermissions = await dal.Query(a => a.IsDeleted == false);
var roleModulePermissions = await base.Query(a => a.IsDeleted == false);
if (roleModulePermissions.Count > 0)
{
foreach (var item in roleModulePermissions)
Expand Down
8 changes: 4 additions & 4 deletions Blog.Core.Services/RoleServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public async Task<Role> SaveRole(string roleName)
{
Role role = new Role(roleName);
Role model = new Role();
var userList = await dal.Query(a => a.Name == role.Name && a.Enabled);
var userList = await base.Query(a => a.Name == role.Name && a.Enabled);
if (userList.Count > 0)
{
model = userList.FirstOrDefault();
}
else
{
var id = await dal.Add(role);
model = await dal.QueryByID(id);
var id = await base.Add(role);
model = await base.QueryByID(id);
}

return model;
Expand All @@ -47,7 +47,7 @@ public async Task<Role> SaveRole(string roleName)
[Caching(AbsoluteExpiration = 30)]
public async Task<string> GetRoleNameByRid(int rid)
{
return ((await dal.QueryByID(rid))?.Name);
return ((await base.QueryByID(rid))?.Name);
}
}
}
2 changes: 1 addition & 1 deletion Blog.Core.Services/TopicDetailServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public TopicDetailServices(ITopicDetailRepository dal)
[Caching(AbsoluteExpiration = 10)]
public async Task<List<TopicDetail>> GetTopicDetails()
{
return await dal.Query(a => !a.tdIsDelete && a.tdSectendDetail == "tbug");
return await base.Query(a => !a.tdIsDelete && a.tdSectendDetail == "tbug");
}
}
}
2 changes: 1 addition & 1 deletion Blog.Core.Services/TopicServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public TopicServices(ITopicRepository dal)
[Caching(AbsoluteExpiration = 60)]
public async Task<List<Topic>> GetTopics()
{
return await dal.Query(a => !a.tIsDelete && a.tSectendDetail == "tbug");
return await base.Query(a => !a.tIsDelete && a.tSectendDetail == "tbug");
}

}
Expand Down
8 changes: 4 additions & 4 deletions Blog.Core.Services/UserRoleServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public async Task<UserRole> SaveUserRole(int uid, int rid)
UserRole userRole = new UserRole(uid, rid);

UserRole model = new UserRole();
var userList = await dal.Query(a => a.UserId == userRole.UserId && a.RoleId == userRole.RoleId);
var userList = await base.Query(a => a.UserId == userRole.UserId && a.RoleId == userRole.RoleId);
if (userList.Count > 0)
{
model = userList.FirstOrDefault();
}
else
{
var id = await dal.Add(userRole);
model = await dal.QueryByID(id);
var id = await base.Add(userRole);
model = await base.QueryByID(id);
}

return model;
Expand All @@ -51,7 +51,7 @@ public async Task<UserRole> SaveUserRole(int uid, int rid)
[Caching(AbsoluteExpiration = 30)]
public async Task<int> GetRoleIdByUid(int uid)
{
return ((await dal.Query(d => d.UserId == uid)).OrderByDescending(d => d.Id).LastOrDefault()?.RoleId).ObjToInt();
return ((await base.Query(d => d.UserId == uid)).OrderByDescending(d => d.Id).LastOrDefault()?.RoleId).ObjToInt();
}
}
}
8 changes: 4 additions & 4 deletions Blog.Core.Services/sysUserInfoServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public async Task<sysUserInfo> SaveUserInfo(string loginName, string loginPWD)
{
sysUserInfo sysUserInfo = new sysUserInfo(loginName, loginPWD);
sysUserInfo model = new sysUserInfo();
var userList = await dal.Query(a => a.uLoginName == sysUserInfo.uLoginName && a.uLoginPWD == sysUserInfo.uLoginPWD);
var userList = await base.Query(a => a.uLoginName == sysUserInfo.uLoginName && a.uLoginPWD == sysUserInfo.uLoginPWD);
if (userList.Count > 0)
{
model = userList.FirstOrDefault();
}
else
{
var id = await dal.Add(sysUserInfo);
model = await dal.QueryByID(id);
var id = await base.Add(sysUserInfo);
model = await base.QueryByID(id);
}

return model;
Expand All @@ -57,7 +57,7 @@ public async Task<sysUserInfo> SaveUserInfo(string loginName, string loginPWD)
public async Task<string> GetUserRoleNameStr(string loginName, string loginPWD)
{
string roleName = "";
var user = (await dal.Query(a => a.uLoginName == loginName && a.uLoginPWD == loginPWD)).FirstOrDefault();
var user = (await base.Query(a => a.uLoginName == loginName && a.uLoginPWD == loginPWD)).FirstOrDefault();
if (user != null)
{
var userRoles = await userRoleServices.Query(ur => ur.UserId == user.uID);
Expand Down

0 comments on commit 10ccc47

Please sign in to comment.