source: FarmatikoServices/Services/PharmacyHeadService.cs@ 4e72684

Last change on this file since 4e72684 was 4e72684, checked in by DimitarSlezenkovski <dslezenkovski@…>, 3 years ago

Add services

  • Property mode set to 100644
File size: 2.1 KB
Line 
1using FarmatikoData.FarmatikoRepoInterfaces;
2using FarmatikoData.Models;
3using FarmatikoServices.FarmatikoServiceInterfaces;
4using System;
5using System.Collections.Generic;
6using System.Linq;
7using System.Text;
8
9namespace FarmatikoServices.Services
10{
11 public class PharmacyHeadService : IPharmacyHeadService
12 {
13 private IPharmacyHeadRepository _pharmacyHeadRepository;
14 public PharmacyHeadService(IPharmacyHeadRepository pharmacyHeadRepository)
15 {
16 _pharmacyHeadRepository = pharmacyHeadRepository;
17 }
18
19 public void Add(PharmacyHead pharmacyHead)
20 {
21 if (pharmacyHead != null)
22 {
23 _pharmacyHeadRepository.Add(pharmacyHead);
24 }
25 }
26
27 public IQueryable<PharmacyHead> GetAllPharmacies(string NameOfPharmacyHead)
28 {
29 if(NameOfPharmacyHead != null)
30 {
31 IQueryable<PharmacyHead> Pharmacy = _pharmacyHeadRepository.GetAllPharmacies(NameOfPharmacyHead);
32 if (Pharmacy != null)
33 {
34 return Pharmacy;
35 }
36 }
37 return null;
38 }
39
40 public IQueryable<PharmacyHead> GetPharmacyByName(string Name)
41 {
42 if(Name != null)
43 {
44 IQueryable<PharmacyHead> PharmacyHead = _pharmacyHeadRepository.GetPharmacyByName(Name);
45 if (PharmacyHead != null)
46 return PharmacyHead;
47 }
48 return null;
49 }
50
51 public IQueryable<MedicineList> GetPharmacyMedicines(string NameOfPharmacy)
52 {
53 if(NameOfPharmacy != null)
54 {
55 IQueryable<MedicineList> Medicines = _pharmacyHeadRepository.GetPharmacyMedicines(NameOfPharmacy);
56 if (Medicines != null)
57 return Medicines;
58 }
59 return null;
60 }
61
62 public void Remove(PharmacyHead pharmacyHead, string Name)
63 {
64 if (pharmacyHead != null && Name != null)
65 {
66 _pharmacyHeadRepository.Remove(pharmacyHead, Name);
67 }
68 }
69 }
70}
Note: See TracBrowser for help on using the repository browser.