so on my get Edit controller i have the following:
public ActionResult Edit(string id)
{
using (ISession session = NhibernateHelper.OpenSession())
{
var site= session.Get<Sitios>(id);
return View(site);
}
}
Which works for bringing my normal textfield properties from that specific site, BUT where im having the problem where im stuck at is when i want to bring in dropdown list in it as well, on the Create action i solved that by using this code:
//GET: Sitios/Create
public ActionResult Create()
{
using (ISession session = NhibernateHelper.OpenSession())
{
var deptos = session.Query<Departaments>().ToList();
var SiteCopy =new Sitios
{
Departaments = deptos
};
return View(SiteCopy);
}
The model part of that specific list is:
public class Sitios
{
//more code
public virtual List<Departamentos> Departamentos { get; set; }
}
And the view for Create action i used which is what i would like to be able to use on my edit view as well is
<div class="form-group">
<label class="control-label col-md-2"> Departament </label>
<div class="col-md-10">
@Html.DropDownListFor(model => model.id_departamento, new SelectList(Model.Departamentos, "id_departamento", "description")
</div>
</div>
So in summary i would like to see if its possible to use the below code which works fine for bringing the string properties of that specific site PLUS add the dropdown in it as well.
public ActionResult Edit(string id)
{
using (ISession session = NhibernateHelper.OpenSession())
{
var sitio = session.Get<Sitios>(id);
return View(site);
}
}
Thanks!