How make a dropdownlist? [Edited - almost working code]

View:

```
<div class="editor-label">
        Firma
    <div class="editor-field">
        @Html.DropDownListFor(x => x.ID_firma, Model.firmaList)
        @Html.ValidationMessageFor(model => model.nazwa)
    </div>

```

Model:

```
 public class produktModel
{
    [Required(ErrorMessage="Proszę podać nazwę.")]
    public string nazwa { get; set; }

    [Required(ErrorMessage = "Proszę podać ilść produktu.")]
    public decimal ilosc { get; set; }

    [Required(ErrorMessage = "Proszę podać jednostkę produktu (np. kg, l, szt.).")]
    public string jednostka { get; set; }

    [Required(ErrorMessage = "Proszę podać cenę produktu.")]
    public decimal cena { get; set; }

    public string ID_firma { get; set; }

    public IEnumerable<SelectListItem> firmaList { get; set; }
}

```

Controller:

```
 public ActionResult dodaj()
    {

        var firma = baza.Firmas;
        var model = new produktModel
        {
            firmaList = firma.AsEnumerable().Select(x => new SelectListItem
            {
                Value = x.ID_firma.ToString(),
                Text = x.nazwa
            })
        };

        return View(model);
    }

    [HttpPost]
    public ActionResult dodaj(produktModel model)
    {

        Produkt prod = new Produkt();

        prod.nazwa = model.nazwa;
        prod.ilosc = model.ilosc;
        prod.jednostka = model.jednostka;
        prod.cena = model.cena;
         prod.ID_firma = model.ID_firma;  

        baza.Produkts.InsertOnSubmit(prod);
        baza.SubmitChanges();

        return RedirectToAction("zarzadzaj_produktami", "Produkt");
    }

```

It almost work...
I have only one problem (I hope)...
Value is string, and I save his value to database... (I don't now how to write it...)

> 
> prod.ID\_firma = model.ID\_firma;
> 
> 
> 

prod.ID\_firma is int. model.ID\_firma is this value which is string. So I have an error:

> 
> Error 1 Cannot implicitly convert type 'string' to 'int?'
> 
> 
>