package app.usluga.web;

import app.model.Oglas;
import app.rep.OglasRep;
import app.usluga.OglasUsluga;
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 java.util.List;

@Controller
@RequestMapping("/oglasi")
public class OglasController
{
    @Autowired
    private OglasUsluga oglasUsluga;



    @RequestMapping("/getAll")
    public  String getAll(Model model)
    {

        List<Oglas> oglasi = oglasUsluga.getAll();
        model.addAttribute("SIZE","3");
        int i=0;
        for(Oglas O : oglasi)
        {
            i++;
            model.addAttribute("A"+String.valueOf(i),O.getIme());

        }



        return "oglasi";
    }
}
