public HttpResponseMessage LoginUser(User userdata)
        {
            var newUrl = "";
            var res    = db.CheckUserExists(userdata.UserName, userdata.Password);

            if (res != null && res.IsAdmin == true)
            {
                newUrl = this.Url.Link("Default", new
                {
                    Controller = "Home",
                    Action     = "AdminView"
                });
                return(Request.CreateResponse(HttpStatusCode.OK, new { result = res, Success = true, RedirectUrl = newUrl }));
            }
            else if (res != null && res.IsAdmin == false)
            {
                newUrl = this.Url.Link("Default", new
                {
                    Controller = "Home",
                    Action     = "UserView"
                });
                return(Request.CreateResponse(HttpStatusCode.OK, new { result = res, Success = true, RedirectUrl = newUrl }));
            }
            else
            {
                newUrl = this.Url.Link("Default", new
                {
                    Controller = "Home",
                    Action     = "LoginView"
                });
                return(Request.CreateResponse(HttpStatusCode.OK, new { Success = true, RedirectUrl = newUrl }));
            }
        }
 //public UserApiController(UserDataAccessLayer _userDB)
 //{
 //    userDb = _userDB;
 //}
 public User CheckUserExists(string username, string password)
 {
     return(userDb.CheckUserExists(username, password));
 }