本文整理汇总了C#中IUserService.GetUsers方法的典型用法代码示例。如果您正苦于以下问题:C# IUserService.GetUsers方法的具体用法?C# IUserService.GetUsers怎么用?C# IUserService.GetUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUserService
的用法示例。
在下文中一共展示了IUserService.GetUsers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UsersViewModel
public UsersViewModel(IUserService userService)
{
_userService = userService;
Users = new List<User>(_userService.GetUsers());
ExitCommand = new DelegateCommand<object>(AppExit, CanAppExit);
}
示例2: UserModule
public UserModule(IUserService userService, IUserRepository userRepository)
: base("/api/v1/users")
{
Before += ctx =>
{
return null;
};
Get["/", true] = async (_, token) =>
{
var users = await userService.GetUsers();
return users;
};
// ?fiter={condition}&limit={limit}&offset={offset}
Get["/", ctx => ctx.Request.Url.Query != string.Empty, true] = async (_, token) =>
{
string filterString = this.Request.Query.filter;
var filter = JsonConvert.DeserializeObject<dynamic>(filterString);
int limit = this.Request.Query.limit;
int offset = this.Request.Query.offset;
var users = await userRepository.GetAsync(u => true, limit, offset, u => u.Name, true);
return users;
};
Post["/", true] = async (_, token) =>
{
//using (var sr = new StreamReader(this.Request.Body))
//{
// var json = sr.ReadToEnd();
//}
var user = this.Bind<User>();
await userService.AddUser(user);
return HttpStatusCode.Created;
};
Put["/{id}", true] = async (_, token) =>
{
var user = this.Bind<User>();
bool success = await userRepository.UpdateAsync(user);
return success ? HttpStatusCode.OK : HttpStatusCode.BadRequest;
};
Delete["/{id}", true] = async (_, token) =>
{
string id = _.id;
bool success = await userRepository.DeleteAsync(_.id);
return success ? HttpStatusCode.OK : HttpStatusCode.BadRequest;
};
Options["/"] = route => new Response();
}
示例3: GetSupportersOfUpdate
public IEnumerable<ApplicationUser> GetSupportersOfUpdate(int id, IUserService userService)
{
return userService.GetUsers().Join(UpdateSupportRepository.GetMany(g => g.UpdateId == id),
u => u.Id,
s => s.UserId,
(u, s) => u);
}
示例4: SearchUserForGroup
public IEnumerable<ApplicationUser> SearchUserForGroup(string searchString, int groupId, IUserService userService, IGroupInvitationService groupInvitationService)
{
var users = from u in userService.GetUsers(searchString)
where !(from g in GetGroupUsersByGroup(groupId) select g.UserId).Contains(u.Id) &&
!(groupInvitationService.IsUserInvited(groupId, u.Id))
select u;
return users;
}
示例5: SearchUserToSupport
public IEnumerable<ApplicationUser> SearchUserToSupport(string searchString, int goalId, IUserService userService, ISupportInvitationService supportInvitationService, string userId)
{
var users = from u in userService.GetUsers(searchString)
where u.Id != userId && !(from g in GetSupporForGoal(goalId) select g.UserId).Contains(u.Id) &&
!(supportInvitationService.IsUserInvited(goalId, u.Id))
select u;
return users;
}