Changeset a55ef91 for FarmatikoServices/Services/MedicineService.cs
- Timestamp:
- 07/31/20 10:15:02 (4 years ago)
- Branches:
- master
- Children:
- d8fafb8
- Parents:
- 4e72684
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoServices/Services/MedicineService.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.Models; 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 using System; 4 5 using System.Collections.Generic; 6 using System.Linq; 5 7 6 8 namespace FarmatikoServices.Services … … 16 18 public void Add(Medicine medicine) 17 19 { 18 _medicineRepository.Add(medicine); 20 try 21 { 22 if (medicine != null) 23 _medicineRepository.Add(medicine); 24 } 25 catch (Exception e) 26 { 27 e = new Exception("Can't Add medicine is null"); 28 throw e; 29 } 19 30 } 20 31 21 public I Enumerable<Medicine> GetAll()32 public IQueryable<Medicine> GetAll() 22 33 { 23 34 return _medicineRepository.GetAll(); 24 35 } 25 36 26 public I Enumerable<Medicine> GetByManufacturer(string Manufacturer)37 public IQueryable<Medicine> GetByManufacturer(string Manufacturer) 27 38 { 28 return _medicineRepository.GetByManufacturer(Manufacturer); 39 try 40 { 41 if (Manufacturer != null) 42 return _medicineRepository.GetByManufacturer(Manufacturer); 43 } 44 catch (Exception e) 45 { 46 e = new Exception("Can't get, name of manufacturer is null"); 47 throw e; 48 } 49 50 return null; 29 51 } 30 52 31 public I Enumerable<Medicine> GetByName(string Name)53 public IQueryable<Medicine> GetByName(string Name) 32 54 { 33 return _medicineRepository.GetByName(Name); 55 try 56 { 57 if (Name != null) 58 return _medicineRepository.GetByName(Name); 59 } 60 catch (Exception e) 61 { 62 e = new Exception("Can't get, name is null"); 63 } 64 65 return null; 34 66 } 35 67 36 68 public void Remove(string Medicine) 37 69 { 38 _medicineRepository.Remove(Medicine); 70 try 71 { 72 if (Medicine != null) 73 _medicineRepository.Remove(Medicine); 74 } 75 catch (Exception e) 76 { 77 e = new Exception("Can't Add medicine is null"); 78 throw e; 79 } 39 80 } 40 81 }
Note:
See TracChangeset
for help on using the changeset viewer.