I've created a small Action in my HomeController to get the skills relating to a User, which the puts this into an Array.
public ActionResult GetAllKeySkills()
{
string currentUserId = User.Identity.GetUserId();
var user = db.Users.FirstOrDefault(u => u.AspNetId == currentUserId).UserId;
var query1 = (from t in db.SkillRoleUsers
join s in db.Skills on t.SkillId equals s.SkillId
where t.UserId == user
select s.SkillName);
return View(System.Tuple.Create(query1.ToArray()));
}
I need this Array to now appear on a page in a TextBox to allow me to apply the Tag-Editor style I have set up.
I was going with something like this, but no dice.
@Html.TextBox("KeySkills",
@Html.Action("GetAllKeySkills", "Home"),
null,
new { htmlAttributes = new { @class = "skills" } })
I've also tried to use a ViewModel, but really don't understand how they work. Any other ideas?
Aucun commentaire:
Enregistrer un commentaire