public IHttpActionResult Get([FromUri] string username)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         Utils.HasAdminPermissions(Request, AuthorizationBusinessLogic);
         User user = UserBusinessLogic.GetUser(username);
         return(Ok(UserModel.ToModel(user)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Example #2
0
        public void IntegrationTest_ExpectedParameters_Ok()
        {
            UserDataAccess    userDA = new UserDataAccess();
            UserBusinessLogic userBL = new UserBusinessLogic(userDA);
            User user1 = Utils.CreateUserForTest();
            User user2 = Utils.CreateUserForTest();

            userBL.AddUser(user1);
            userBL.AddUser(user2);

            user2.Name = "Other name";
            userBL.ModifyUser(user2);

            userBL.DeleteUser(user1.Username);

            User         user2Obtained = userBL.GetUser(user2.Username);
            IList <User> usersObtained = userBL.GetUsers();

            Assert.IsTrue(!usersObtained.Contains(user1) && usersObtained.Contains(user2Obtained));
        }
Example #3
0
        public ActionResult Details(int id)
        {
            var user = UserBusinessLogic.GetUser(id);

            return(View("User", user));
        }