I have a function in a controller, and I receive the information for a form. I have this code:
public Actionresult functionOne(string a, string b, string c = "foo" )
I tried to convert this to a class like
public class bar
{
    public string a {get;set;}
    public string b {get;set;}
    public string c {get;set;}
}
and receive them as a object
 public Actionresult functionOne(bar b)
Also I tried to put the defaultvalue in 'c' but is not working, I tried this:
public class bar
{
    public string a {get;set;}
    public string b {get;set;}
    [System.ComponentModel.DefaultValue("foo")]
    public string c {get;set;}
}
Nothing happened with that, I receive it as null
also I tried
public class bar
{
    public string a {get;set;}
    public string b {get;set;}
    public string c 
    {
        get
        {
            return  c;
        }
        set
        {
            c="foo"; //I also tried with value
        }
    }
}
What should I do to write this default value?
 
     
     
     
     
    