I'm doing a project in Visual Studio 2013, with EntityFramework version 6.1.3, MVC 4.5.0.0 and using ViewModel .
I'm programming a page called payment condition. The creation page will have a text field nome
, 2 radiobuttons
: "the view" and "term". If the user selects the view nothing will happen.
Now, if the radiobutton
"term" is selected, a button will appear to add textbox
s of the term days to be filled. I need to do this schedule to add the textbox
s as click the add days button and then do a function to write to the bank.
I think the function of the add days button can do in Jquery, and then the create button that will add a function in the Controller .
I know jquery, do add textboxes, now I'm a little lost in the C # part, writing to the bank made in Controller .
Thecodebelowisfrommyviewmodel:
[Key][DisplayName("Id")]
public int CondicaoPagamentoId { get; set; }
[Required(ErrorMessageResourceName = "PropertyValueRequired", ErrorMessageResourceType = typeof(DataAnnotationsResources))]
[MinLength(DataConfig.DATABASE_MIN_LENGTH_DEFAULT, ErrorMessageResourceName = "MinLengthAttribute_ValidationError", ErrorMessageResourceType = typeof(DataAnnotationsResources))]
[MaxLength(DataConfig.DATABASE_MAX_LENGTH_DEFAULT, ErrorMessageResourceName = "MaxLengthAttribute_ValidationError", ErrorMessageResourceType = typeof(DataAnnotationsResources))]
[DisplayName("Nome")]
public string Nome { get; set; }
[Required(ErrorMessageResourceName = "PropertyValueRequired", ErrorMessageResourceType = typeof(DataAnnotationsResources))]
[MinLength(DataConfig.DATABASE_MIN_LENGTH_DEFAULT, ErrorMessageResourceName = "MinLengthAttribute_ValidationError", ErrorMessageResourceType = typeof(DataAnnotationsResources))]
[MaxLength(DataConfig.DATABASE_MAX_LENGTH_DEFAULT, ErrorMessageResourceName = "MaxLengthAttribute_ValidationError", ErrorMessageResourceType = typeof(DataAnnotationsResources))]
[DisplayName("Tipo")]
public bool Tipo { get; set; }
[Required(ErrorMessageResourceName = "PropertyValueRequired", ErrorMessageResourceType = typeof(DataAnnotationsResources))]
[DisplayName("Dias")]
public int CondicaoPagamentoDiasId { get; set; }
public virtual CondicaoPagamentoDiasViewModel CondicaoPagamentoDias { get; set; }
public virtual IEnumerable<CondicaoPagamentoDiasViewModel> CondicaoPagamentoDiass { get; set; }
[DisplayName("Cadastrado por")]
public int UsuarioCadastroId { get; set; }
public virtual UsuarioViewModel UsuarioCadastro { get; set; }
[DisplayName("Data de Cadastro")]
public DateTime DataCadastro { get; set; }
the addition is made by:
this.add(objeto)