0
I have a Customer Class, which uses 1 or several systems.
public class ClienteEmpresa : Pessoa
{
public virtual ICollection<TipoDeSistemas> TipoDeSistemas { get; set; }
}
In my Action Get Create I search the list in the bank and send to the view
public ActionResult _frmCadastroCliente()
{
ViewBag.SistemaComercial = new SelectList(db.TipoDeSistemaDb, "Id", "Descricao");
return PartialView();
}
In my View I have a select that receives this list.
<div class="row">
<div class="col-md-12" style="margin-left:10px; min-width:100%;">
<div class="form-group" style="margin-left:-7px; margin-top:17px;margin-bottom:11px;">
<label for="vat" class=" form-control-label">Tipo De Sistema</label>
@Html.DropDownList("SistemaComercial", null, htmlAttributes: new { @class = "standardSelect", multiple = "multiple" })
</div>
</div>
</div>
In my Action Post Create I get an array of Ids.
public ActionResult Create(ClienteEmpresaViewModel clienteEmpresaviewmodel, int[] SistemaComercial)
{
//Aqui que eu quero saber como tratar e salvar essa lista.
//Eu tentei Assim
foreach (var sistema in SistemaComercial)
{
//Mas não sei como salvar.
}
}
Could someone give me a hint on how to assign this list to my Client?