The parameters you have passed to the method are not getting utilized in the logic of the method. In below line of code, You have passed the value as a static string in where clause of your query and not as a variable.
list<contact> ContactList=[select id,name,lastname,mailingpostalcode from contact where lastname=:'lastname' and mailingpostalcode=:'MailingPostalcode'];
Instead you need to remove the single quotes from lastname and mailingpostalcode in where clause and it will solve your problem.
list<contact> ContactList=[select id,name,lastname,mailingpostalcode from contact where lastname=:lastname and mailingpostalcode=:MailingPostalcode];
You should know about using a bind variable in soql query.
SOQL and SOSL statements in Apex can reference Apex code variables and
expressions if they’re preceded by a colon (:). This use of a local
code variable within a SOQL or SOSL statement is called a bind. The
Apex parser first evaluates the local variable in code context before
executing the SOQL or SOSL statement.
Read more about it here:- Using Apex Variables in SOQL and SOSL Queries