public HttpResponseMessage GetAllUsers( [ValueProvider(typeof(HeaderValueProviderFactory <String>))] String sessionKey) { var user = usersRepository.GetBySessionKey(sessionKey); if (user != null) { var users = usersRepository.All() .Select(u => new UserModel() { Id = u.Id, Username = u.Username, FirstName = u.FirstName, LastName = u.LastName, ProfilePictureUrl = u.ProfilePictureUrl }); return(Request.CreateResponse(HttpStatusCode.OK, users)); } return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid session key")); }
public IEnumerable <User> GetAllUsers() { return(data.All()); }
public async Task <ActionResult <List <User> > > Index() { return(await _rep.All()); }