Esempio n. 1
0
        public ServiceDTO GetByLawyerId(int ServiceId, int lawyerId)
        {
            var lawyer  = lawyerRepository.Get(s => s.Id == lawyerId, null, "Services").FirstOrDefault();
            var service = ServiceRepository.Get(s => s.Id == ServiceId, includeProperties: "Prices,Lawyers").FirstOrDefault();

            if (lawyer != null && service != null)
            {
                var serv = ServiceDTO.ToServiceDTO(service, lawyer);
                return(serv);
            }

            return(null);
        }
Esempio n. 2
0
 public ServiceDTO GetById(int Id)
 {
     return(ServiceDTO.ToServiceDTO(ServiceRepository.Get(Id)));
 }
Esempio n. 3
0
        public IEnumerable <ServiceDTO> Get(int lawyerId = 0)
        {
            Expression <Func <DAL.Models.Service, bool> > filter = s => s.Id > 0;

            if (lawyerId > 0)
            {
                filter = s => s.Lawyers.Any(a => a.LawyerId == lawyerId);
            }
            var lawyer = lawyerRepository.Get(l => l.Id == lawyerId, null, "Services").FirstOrDefault();
            var lst    = ServiceRepository.Get(filter, includeProperties: "Prices").Select(s => ServiceDTO.ToServiceDTO(s, lawyer)).ToList();

            return(lst);
        }