<?php

namespace WpBookingProFrontend\app\controllers;

use WpBookingPro\Factory;
use WpBookingPro\Filesystem\Support\StringController;
use WpBookingPro\Mvc\Controller\ControllerFrontend;
use WpBookingPro\Mvc\Model\Model;
use WpBookingPro\Utilities\Utility;
use WpBookingProFrontend\app\helpers\ConfigHelper;
use WpBookingProFrontend\app\helpers\EmailHelper;

defined('_WPBOOKINGPRO_EXEC') or die;

/**
 * Class StateController
 */

class LocationController extends ControllerFrontend
{
    public function save($data = array())
    {
        $input = Factory::getInput();
        $data = $input->getData();
        $page_my_location = isset($data['page_my_location'])?$data['page_my_location']:'';
        $modelLocation = Model::getInstance('location');
        $location =  $modelLocation->save($data); // TODO: Change the autogenerated stub
        Utility::redirect($page_my_location);

    }

    public function delete($id = 0)
    {
        $input = Factory::getInput();
        $location_id = $input->getInt('location_id',0);
        $page_my_location = $input->getString('page_my_location','');
        $modelLocation = Model::getInstance('location');
        $modelLocation->delete($location_id);
        Utility::redirect($page_my_location);
    }

}
