Imagine that you are a dictator in Sausageland. Your legitimicay depends on you delevering sausages to the inhabitants. Each inhabitant must be given 1 sausage and there are $y$ inhabitants. To produce sausages you command two factories: One factory produces $x_1$ vegan sausages using $x_1$ cabbage heads the other factory produces $x_2$ pork sausages using $x_2$ units of pork meat. Which factory do you use?
Well since the factories are equally productive transforming one unit of input into one unit of output independent of the level of production $y$ you simple follow the rule of cost minimizing and use the factory for which the input is the cheapest.
Vegan sausage case:
So in the case where $w_1<w_2$ it follows that $\min(w_1,w_2) = w_1$ and $y=x_1$ so costs are $w_1x_1$ which is $\min(w_1,w_2)y$.
Pork sausage case:
So in the case where $w_2<w_1$ it follows that $\min(w_1,w_2) = w_2$ and $y=x_2$ so costs are $w_2x_2$ which is $\min(w_1,w_2)y$.
In the knife edge case where $w_1=w_2$ it does not matter whether you produce pork
sausages or cabbage sausages they are equally costly to produce so the only requirement is that the total number of sausages add up to $y$ hence $x_1+x_2=y$ with the solution set $\{(x_1,x_2) \lvert x_1+x_2=y,x_1\geq0,x_2\geq 0\}$.
Combined sausage case:
So in the case where $w_2=w_1$ it follows that $\min(w_1,w_2) = w_2=w_1$ and $y=x_2+x_1$ so costs are $w_1x_1+w_2x_2 = w_1(x_1+x_2) = w_1 y$ which is $\min(w_1,w_2)y$.
So in all three cases the cost function can be written as
$$C(w_1,w_2,y) = \min(w_1,w_2)y$$
Cost minimizing program
Another approach is to set up the cost minimizing program. The costs are given as $w_1x_1 + w_2x_2$ which is the objective function to be minimized. The constraints are that $f(x_1,x_2) = x_1 + x_2 \geq y$ and $x_1\geq 0$ and $x_2\geq 0$.
The cost function is derived by solving the problem
$$\min_{x_1,x_2} \ \ w_1x_1 + w_2x_2 \\ s.t. \ \ x_1 + x_2 \geq y \\ \ \ x_1 \geq 0 \\ \ \ x_2 \geq 0$$
The costs are given as $w_1x_1 + w_2x_2$ and they are to be minimized subject to the constraint that at least $y$ is produced as output.
One potential first step could be to check if some of the inequality constraints must be binding in optimum. So consider the case where $f(x_1,x_2) = x_1 + x_2 > y$ for which a numerical example could be that you are supposed to produce at least $y=4$ and you produce $f(x_1,x_2)=4.1$ using inputs $x_1=2.1$ and $x_2=2$. Clearly you could reduce costs by using less $x_1$ and still respecting the constraint $x_1 + x_2 \geq y$ (I am assuming that $w_1$ and $w_2$ are both strictly positive so reducing $x_1$ decrease costs $w_1x_1 + w_2x_2$). Hopefully you can convince yourself that it would always be a waste of money to produce more output $f(x_1,x_2) = x_1 + x_2$ than required $y$. And you can therefore conclude that any solution $(x_1^\star,x_2^\star)$ must satisfy
$$(1) \ \ x_1 + x_2 = y.$$
You now have one equation in two unknowns which is great progress but not enough.
Again you follow the procedure of considering the three cases $w_1>w_2$, $w_2>w_1$ and $w_1=w_2$. For the cases $w_1\not =w_2$ you should be able to convince yourself that you produce with the cheapest production factor and therefore for the other factor you have $x_i = 0$. In either case you have two equations with two unknowns and by similar arguments as above $\min(w_1,w_2) y$ are the costs.
In the knife edge case where $w_1=w_2$ non of the constraints $x_1\geq 0$ and $x_2\geq 0$ are binding. You therefore do not end up with two equation in two unknowns and but simly have the inequalities $x_1\geq 0$ and $x_2 \geq 0$ and the equality $x_1+x_2=y$ and infinitely many solutions $\{(x_1,x_2) \lvert x_1\geq 0, x_2 \geq 0,x_1+x_2=y\}$. Obviously, this can seem annoying when hoping for a unique solution. However, you should be familiar with this case from utility maximization for perfect substitutes.
Lagrange
You can perfectly well use Lagrange for this problem. However, imagine that you forget the positivity constraints on $x_1$ and $x_2$ then your Lagrangian function becomes
$$L(x_1,x_2) = w_1x_1 + w_2x_2 - \lambda(x_1 + x_2 - y),$$
with first order conditions
$$w_1 - \lambda = 0 \\ w_2 - \lambda = 0$$
using the assumption that $w_1>0$ it follows by the complementarity condition $\lambda(x_1 + x_2 - y)=0$ that $x_1 + x_2 - y=0$ so $x_1+x_2=y$. That is not a problem.
However, you also have the implication that $\lambda = w_1 = w_2$ which is a problem because it excludes the real possibilities that $w_1\not = w_2$. Nevertheless, let us assume that $w_1=w_2$ then the FOC do not tell us anything about $(x_1,x_2)$ and are trivially satisfied by any $(x_1,x_2)$. Again you are left with the solution being all $(x_1,x_2)$ where $x_1+x_2=y$ for the case where $w_1=w_2$. In this case it is not wrong bu it is incomplete.
So including the positivity constraints in the Lagrangian you get
$$L(x_1,x_2) = w_1x_1 + w_2x_2 - \lambda(x_1 + x_2 - y) - \delta_1x_1 - \delta_2 x_2$$
with FOC's
$$w_1 - \lambda - \delta_1 = 0$$
$$w_2 - \lambda - \delta_2 = 0$$
Here you should use the complemetarity conditions to consider which inequalitites are binding in optimum.
So first assume that $x_1>0$ then by complementarity $\delta_1 x_1=0$ it follows that $\delta_1=0$. Using the first order condition you then get that $w_1 = \lambda$ and since $w_1>0$ it follows that $\lambda>0$. Using that $\lambda>0$ in combination with the complementarity condition $\lambda(x_1+x_2-y)=0$ you get $x_1+x_2=y$.
Combining $w_1=\lambda$ with the second FOC $w_2 - \lambda - \delta_2=0$ implies that $w_2 - w_1 = \delta_2$. It is known from KKT-theorem that $\delta_2\geq 0$. If we assume $\delta_2 = 0$ we are back in the solution $w_1=w_2$ so we instead let $\delta_2>0$ but by complementarity this then implies that $x_2=0$ and by the identity $w_2 - w_1 = \delta_2$ this is the case where $w_2>w_1$.
A completely symmetrical arguments is used to solve for $w_1>w_2$. But as you can see using Lagrange is tedious in this simple case. For a statement of the KKT-theorem you can see Nocedal and Wright page 328.