so... it's a pretty dumb question but i was searching and didn't found a didatic answer...
I created this Class on my Helpers folder, to use it on the controller, to make some clean code...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace CarroBemGuardado.Helpers
{
public class CalcularValorPagar
{
static decimal CalcularPagamento (string dur, decimal ph, decimal hadd)
{
decimal valorpagar = 0;
decimal horas = Convert.ToDecimal(dur.Substring(0, 2));
decimal minutos = Convert.ToDecimal(dur.Substring(3, 2));
if ((horas == 0) && (minutos <= 30))
{
valorpagar = ph / 2;
}
else if ((horas > 0) && (minutos > 10))
{
valorpagar = ph + (hadd * horas);
}
else if ((horas > 0) && (minutos < 10))
{
valorpagar = ph + (hadd * (horas - 1));
}
else
{
valorpagar = ph;
}
return valorpagar;
}
}
}
But i'm trying to call the method CalcularPagamento on my controller (and pass the 3 parameters to it) but i can't. I can only call the Class. I tried to instantiate the Class to call the method but also didn't worked.
How can i do that ?