can you please tell my what is wrong with my code and what am i doing wrong with my code because my post paramethar is returning null? This is my code:
[HttpGet]
public ActionResult ImeRabota()
{
var categories = new List<IzberiRabota>();
foreach (var category in databaseprofil.Rabotas.ToList())
{
categories.Add(new IzberiRabota
{
id = category.Id,
Ime = category.Ime,
Assigned = false
});
}
return View(categories);
}
[HttpPost]
public ActionResult ImeRabota(List<IzberiRabota> rabota)
{
return View();
}
and this is my html view I don't know what is it:
@model IEnumerable<Rabotnik.mk.Models.IzberiRabota>
....
@using (Html.BeginForm("ImeRabota", "Profil", FormMethod.Post))
{
@Html.AntiForgeryToken()
@foreach (var product in Model)
{
@Html.CheckBoxFor(Model => product.Assigned)
@product.Ime;
}
<input type="submit" value="Submit" class="btn btn-success" />
}
And this is my ViewModel
public class IzberiRabota
{
public int id { get; set; }
public string Ime { get; set; }
public bool Assigned { get; set; }
}