Hi, I'm pretty sure that I complicated my question. Sorry, I didn't know how to express myself. Situation is next :
public ActionResult Edit(int id)
{
CreateTrainingModel editTrainingModel = new CreateTrainingModel();
editTrainingModel.Training = training.GetByID(id);
editTrainingModel.Player = player.GetAll();
return View(editTrainingModel);
}
and Editor template for Html.EditorFor() :
@inherits System.Web.Mvc.WebViewPage<TrainingStatistics.Models.ViewModels.CreateTrainingModel>
@Html.ValidationSummary()
<table>
@Html.HiddenFor(x => x.Training.TrainingID)
<tr>
<td>Training Date</td>
<td><input type="text" id="datepicker" name="Training.Date"></td>
<td>@Html.ValidationMessageFor(x => x.Training.Date)</td>
</tr>
</table>
Problem is that when I want to edit this, data from model aren't passed to the view. I think that problem is because of using ViewModels and I'm doing something wrong here..When I try to update something which is consist of only one entity (example Player) and when I'm not using ViewModel everything is fine.
Thank you in advance!