Exemple #1
0
        public IActionResult GetAdmin(string arg1, string arg2)
        {
            Admin obj = repo.GetUser(arg1, arg2);

            if (obj != null)
            {
                return(Ok(obj));
            }
            else
            {
                return(NotFound("Aduh ga ada"));
            }
        }
Exemple #2
0
        //Autentikasi admin
        private UserModel Authenticate(Admin login)
        {
            UserModel user = null;
            RepoUser  repo = new RepoUser();

            try
            {
                Admin temp = repo.GetUser(login.Username, login.Password);
                user = new UserModel {
                    Name = temp.Username, Time = DateTime.Now
                };
                return(user);
            }
            catch (Exception)
            {
                return(user);
            }
        }