/*******************************************************************************
 * Copyright 2019 2Fi Business Solutions Ltd.
 *
 *
 *
 * This code is copyrighted. Under no circumstances should any party, people,
 * or organization should redistribute any portions of this code in any form,
 * either verbatim or through electronic media, to any third parties, unless
 * under explicit written permission by 2Fi Business Solutions Ltd.
 ******************************************************************************/
package com.ffii.tbms.example.web;

import com.ffii.core.web.view.json.JsonView;
import com.ffii.tbms.example.service.ExampleService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping(value = "/example")
public class ExampleController {

	@Autowired
	private ExampleService exampleService;

	@RequestMapping("/1")
	public String example1(@RequestParam(defaultValue = "Pig") String name, Model model) {
		model.addAttribute("name", name);
		return JsonView.NAME;
	}

	@RequestMapping("/test2")
	public String test2(Model model) {
		exampleService.updateStatusWithAuditLog();
		return JsonView.NAME;
	}

}
