3
I need to create a View Model to use on the screen.
I’m wondering where to put the button rule be enabled or not.
I thought about this implementation, I would like to know if it is the best way. Another idea I had was to put the contents of the constructor in a class of Business
.
public class ApoQueueVM
{
public ApoQueueVM(ApoQueue apoQueue, ApoFileBL apoFileBL)
{
this.EnableExport = apoQueue.Status == ApoQueueStatus.Gerado.ToString() || apoQueue.Status == ApoQueueStatus.Enviado.ToString();
this.KeyFigure = apoQueue.KeyFigure;
this.PathFileGenerated = apoFileBL.GetFullPathApo(apoQueue, true);
}
public string KeyFigure { get; set; }
public bool HaveInconsistencies { get; set; }
public string PathFileGenerated { get; set; }
public bool EnableExport { get; set; }
}
For the specific case of Viewmodels, there is no construction anywhere else of the application that is not necessarily the Action of Controller of it, then the concern is not necessary. Now, if we were talking about Models and even Controllers, then I agree with you.
– Leonel Sanches da Silva