package app.usluga.web;


import app.model.Oglas;
import app.usluga.OglasUsluga;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.ui.Model;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import java.util.List;

@Controller
public class MainKontroler {
	
	@GetMapping("/login")
	public String prikaziLogin() {
		return "login";
	}
	
	@GetMapping("/")
	public String prikaziHome() {
		return "index";
	}


	@GetMapping("/dodaj")
	public String prikazidodaj() {
		return "dodaj";
	}



	@GetMapping("/maintance")
	public String maintance() {
		return "maintance";
	}


	@Autowired
	private OglasUsluga oglasUsluga;

	@GetMapping("/oglasi")
	public String prikazOglasa(Model model)
	{

		List<Oglas> oglasi = oglasUsluga.getAll();
		model.addAttribute("oglasi",oglasi);

		return "property";

	}


}
