public IHttpActionResult GetUser(int id) { User u = null; using (DAL.UserRepository repo = new DAL.UserRepository(_con)) { u = UserConverter.ConvertTo(repo.GetById(id)); } if (u == null) { return(NotFound()); } return(Ok(u)); }
public async Task <IEnumerable <UserResponse> > GetAdminUsers() { var users = await UserRepository.GetEntityListAsync(); return(users.Select(x => UserConverter.ConvertTo(x))); }
public IEnumerable <User> GetAllUsers() { User[] toReturn; using (DAL.UserRepository repo = new DAL.UserRepository(_con)) { toReturn = UserConverter.ConvertTo(repo.GetAll()); } return(toReturn); }