I have done so to avoid extra View Model mappings in Business class. Example:

public class PatientInfoBusiness
{
    public List<PatientInfo> GetPatientInfo()
    {
        IPatientInfoService proxy = new VRFactory().GetPatientInfoServiceProxy();
        var piData= proxy.GetPatientInfoSectionData();

        //var patientInfoVM= new List<patientInfoVM>();
        //piData.ForEach( a => patientInfoVM.Add(
        //                                                          new patientInfoVM
        //                                                          {
        //                                                              AcknowledgedUserName = a.AcknowledgedUserName,
        //                                                              Description = a.Description,
        //                                                              PriorityCode = a.PriorityCode,
        //                                                              Status = a.Status
        //                                                          }
        //                                        )
        //                );

        return piData;
    }
}

Shifted the commented code in the above Business to View, looping through and displaying in HTML. This way no need of patientInfoVM View Model. But I am skipping the business layer altogether and binding the entity from service layer directly in view!

Related posts

Recent Viewed