defmodule OutlookWeb.ArtikelController do use OutlookWeb, :controller alias Outlook.Public def index(conn, _params) do artikel = Public.list_artikel() render(conn, :index, artikel: artikel, page_title: "Artikel") end def show(conn, %{"tid" => tid} = params) do case Public.get_artikel_by_tid(tid) do {:ok, artikel} -> render(conn, :show, artikel: artikel, page_title: artikel.title) {:error, message} -> conn |> put_status(404) |> put_view(OutlookWeb.ErrorHTML) |> render("404.html") |> halt() end end end