public void approve_discrepency(HttpContext context)
        {
            User user = getUserByAccessToken(context.Request.Form["access_token"]);
            Message message = new Message(false);

            if (user != null)
            {
                if (user.user_type != 5 || user.user_type != 6)
                {
                    DiscrepencyController discrepencyController = new DiscrepencyController();
                    String[] id = context.Request.Form.GetValues("id");

                    for (int i = 0; i < id.Length; i++)
                    {
                        discrepencyController.actionApproveDiscrepancies(Convert.ToInt32(id[i]));
                    }
                    message.condition = true;
                    message.message = "Successfully Approved.";
                } else {
                    message.message = "Access denied!";
                }
            }
            else {
                message.message = "User token is invilid!";
            }

            context.Response.Write(JsonConvert.SerializeObject(message));
        }
        public void check_access_token(HttpContext context)
        {
            User user = getUserByAccessToken(context.Request.Form["access_token"]);
            Message message = new Message(false);

            if (user != null)
            {
                if (user.user_type == 5 || user.user_type == 6)
                {
                    message.condition = true;
                }
            }
            else
            {
                message.message = "Invilid or Expire Token!";
            }

            context.Response.Write(JsonConvert.SerializeObject(message));
        }
        public void logout(HttpContext context)
        {
            User user = getUserByAccessToken(context.Request.Form["access_token"]);
            Message message = new Message(false);

            if (user != null)
            {
                message = new OAuthController().actionDeleteTokenByToken(context.Request.Form["access_token"]);
            }

            context.Response.Write(JsonConvert.SerializeObject(message));
        }
 public MainController()
 {
     data = new DataContext();
     message = new Message();
 }