5
I have an object called Radio
:
public class Radio
{
public int RadioId { get; set; }
public string StreamUrl { get; set; }
public bool Ativo { get; set; }
public bool Mp3 { get; set; }
}
I’m doing a select on controller and trying to send her to View:
var RadioAtivo = db.Radios
.Where(p => p.Ativo == true && p.Mp3 == false)
.Take(1);
return View(RadioAtivo.ToList());
In the view, would like to recover, for example, the field StreamURL
@model List<RadioFM.Domain.Domain.Radio>
<p>@Html.DisplayFor(r => r.???) </p>
I thought I’d put in a ViewBag
, but I found it a bit tricky. I thought of creating a ViewModel
already with the data, but I thought it would be kind of duplicate a problem.
What’s the simplest solution in this case?
perfect, I appreciate the attention as always, it is a project for myself, without commercial objectives, just for learning the MVC.
– Dorathoto
@Gypsy omorrisonmendez, why
RadioFM.Domain.Domain.Radio
would be an anti-pattern? I was curious.– Tobias Mesquita
@Tobymosque If you have one Class Library calling for
RadioFM.Domain
, why you need to have a directoryDomain
inside her? That one Class Library keeps something other than theDomain
?– Leonel Sanches da Silva