I'm confused how to return the result from the business layer. Sometimes I need to return the message if it does not pass the criteria. For example:
public SalesDTO GetSalesByPrescriptionNo(string prescriptionNo)
{
int count = unitOfWork.SalesRepository.GetNumberOfPrescriptionUsed(prescriptionNo);
if (count > 5)
// I cannot return string/error information
// since the function is return SalesDTO type
return "Cannot used anymore";
var sales = unitOfWork.SalesRepository.GetSalesByPrescriptionNo(prescriptionNo);
var salesDTO = Mapper.MapToDTO(sales);
return salesDTO;
}
Based on the good OOP/OOD implementation, how should I handle the multiple result from the BLL?
Thanks in advanced.
Aucun commentaire:
Enregistrer un commentaire