Changeset a55ef91
- Timestamp:
- 07/31/20 10:15:02 (4 years ago)
- Branches:
- master
- Children:
- d8fafb8
- Parents:
- 4e72684
- Files:
-
- 2 added
- 2 deleted
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/Controllers/HealthFacilitiesController.cs
r4e72684 ra55ef91 1 1 using FarmatikoData; 2 2 using FarmatikoData.Models; 3 using Microsoft.AspNetCore.Cors;3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 4 using Microsoft.AspNetCore.Mvc; 5 using Microsoft.Extensions.Logging; 6 using Newtonsoft.Json; 7 using Newtonsoft.Json.Linq; 8 using System; 5 9 using System.Collections.Generic; 10 using System.Linq; 11 using System.Net; 12 using System.Threading.Tasks; 6 13 7 14 namespace Farmatiko.Controllers … … 12 19 { 13 20 private IHealthFacilityService _healthFacilitiesService; 14 public HealthFacilitiesController(IHealthFacilityService healthFacilitiesService) 21 private IProcessJSONService _processJSONService; 22 /*private IProcessJSONService _processJSONService;*/ 23 private string Path = @"C:\Users\dslez\Desktop\ustanovi.json"; 24 public HealthFacilitiesController(IHealthFacilityService healthFacilitiesService, IProcessJSONService processJSONService) 15 25 { 16 26 _healthFacilitiesService = healthFacilitiesService; 27 _processJSONService = processJSONService; 17 28 } 18 29 [HttpGet] 19 public I Enumerable<HealthFacilities> Get()30 public IQueryable<HealthFacilities> Get() 20 31 { 21 32 return _healthFacilitiesService.GetAll(); 22 33 } 34 /* public void Index() 35 36 { 37 _processJSONService.GetProcessedHealthFacilitiesFromJSON(); 38 }*/ 23 39 } 24 40 } -
Farmatiko/Controllers/HealthcareWorkerController.cs
r4e72684 ra55ef91 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Threading.Tasks; 1 using System.Linq; 5 2 using FarmatikoData.Models; 6 3 using FarmatikoServices.FarmatikoServiceInterfaces; … … 20 17 21 18 [HttpGet] 22 public I Enumerable<HealthcareWorkers> Get()19 public IQueryable<HealthcareWorkers> Get() 23 20 { 24 21 return _healthcareWorkerService.GetAll(); -
Farmatiko/Controllers/MedicineController.cs
r4e72684 ra55ef91 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Threading.Tasks; 1 using System.Linq; 5 2 using FarmatikoData.Models; 6 3 using FarmatikoServices.FarmatikoServiceInterfaces; … … 19 16 } 20 17 [HttpGet] 21 public I Enumerable<Medicine> Get()18 public IQueryable<Medicine> Get() 22 19 { 23 20 return _medicineService.GetAll(); 24 21 } 22 /*[HttpPost] 23 public void Add(Medicine medicine) 24 { 25 _medicineService.Add(medicine); 26 } 27 [HttpPost] 28 public void Remove(string Medicine) 29 { 30 _medicineService.Remove(Medicine); 31 } 32 [HttpGet] 33 public IQueryable<Medicine> GetByName(string Name) 34 { 35 return _medicineService.GetByName(Name); 36 } 37 [HttpGet] 38 public IQueryable<Medicine> GetByManufacturer(string Manufacturer) 39 { 40 return _medicineService.GetByManufacturer(Manufacturer); 41 }*/ 25 42 } 26 43 } -
Farmatiko/Controllers/MedicineListController.cs
r4e72684 ra55ef91 1 1 using System.Collections.Generic; 2 using System.Linq; 2 3 using FarmatikoData.Models; 3 4 using FarmatikoServices.FarmatikoServiceInterfaces; … … 16 17 } 17 18 [HttpGet] 18 public I Enumerable<MedicineList> Get()19 public IQueryable<MedicineList> Get() 19 20 { 20 21 return _medicineListService.GetAll(); 21 22 } 23 [HttpGet] 24 public ICollection<MedicineList> GetByName(string Name) 25 { 26 return _medicineListService.GetByName(Name); 27 } 28 [HttpGet] 29 public ICollection<MedicineList> GetByManufacturer(string Manufacturer) 30 { 31 return _medicineListService.GetByManufacturer(Manufacturer); 32 } 33 /*[HttpPost] 34 public void SetHasMedicine(MedicineList medicineList, bool HasMedicine) 35 { 36 _medicineListService.SetHasMedicine(medicineList, HasMedicine); 37 }*/ 38 [HttpPost] 39 public void Add(MedicineList medicineList) 40 { 41 _medicineListService.Add(medicineList); 42 } 43 [HttpPost] 44 public void Remove(MedicineList medicineList) 45 { 46 _medicineListService.Remove(medicineList); 47 } 22 48 } 23 49 } -
Farmatiko/Controllers/PandemicController.cs
r4e72684 ra55ef91 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Threading.Tasks; 1 using System.Linq; 5 2 using FarmatikoData.Models; 6 3 using FarmatikoServices.FarmatikoServiceInterfaces; … … 19 16 } 20 17 [HttpGet] 21 public I Enumerable<Pandemic> Get()18 public IQueryable<Pandemic> Get() 22 19 { 23 20 return _pandemicService.GetAll(); -
Farmatiko/Controllers/PharmacyController.cs
r4e72684 ra55ef91 1 using System; 2 using System.Collections.Generic; 1 using System.Collections.Generic; 3 2 using System.Linq; 4 using System.Threading.Tasks;5 3 using FarmatikoData.Models; 6 4 using FarmatikoServices.FarmatikoServiceInterfaces; … … 19 17 } 20 18 [HttpGet] 21 public I Enumerable<Pharmacy> Get()19 public IQueryable<Pharmacy> Get() 22 20 { 23 21 return _pharmacyService.GetAll(); 24 22 } 23 [HttpGet] 24 public ICollection<Pharmacy> GetPharmacies() 25 { 26 return _pharmacyService.GetPharmacies(); 27 } 28 [HttpPost] 29 public void UpdatePharmacy(Pharmacy pharmacy, string Name) 30 { 31 _pharmacyService.UpdatePharmacy(pharmacy,Name); 32 } 33 [HttpPost] 34 public void AddPharmacy(Pharmacy pharmacy) 35 { 36 _pharmacyService.Add(pharmacy); 37 } 38 [HttpPost] 39 public void RemovePharmacy(Pharmacy pharmacy) 40 { 41 _pharmacyService.Remove(pharmacy); 42 } 25 43 } 26 44 } -
Farmatiko/Controllers/PharmacyHeadController.cs
r4e72684 ra55ef91 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Threading.Tasks; 1 using System.Linq; 5 2 using FarmatikoData.FarmatikoRepoInterfaces; 6 3 using FarmatikoData.Models; … … 23 20 return _pharmacyHeadRepository.GetAllPharmacies(NameOfPharmacy); 24 21 } 22 [HttpGet] 23 public IQueryable<PharmacyHead> GetPharmacyByName(string Name) 24 { 25 return _pharmacyHeadRepository.GetPharmacyByName(Name); 26 } 27 [HttpGet] 28 public IQueryable<MedicineList> GetPharmacyMedicines(string NameOfPharmacy) 29 { 30 return _pharmacyHeadRepository.GetPharmacyMedicines(NameOfPharmacy); 31 } 32 [HttpPost] 33 public void Add(PharmacyHead pharmacyHead) 34 { 35 _pharmacyHeadRepository.Add(pharmacyHead); 36 } 37 [HttpPost] 38 public void Remove(PharmacyHead pharmacyHead, string Name) 39 { 40 _pharmacyHeadRepository.Remove(pharmacyHead, Name); 41 } 25 42 } 26 43 } -
Farmatiko/Startup.cs
r4e72684 ra55ef91 67 67 services.AddTransient<IPharmacyRepository, PharmacyRepository>(); 68 68 services.AddTransient<IPharmacyService, PharmacyService>(); 69 70 services.AddTransient<IProcessJSONService, ProcessJSONService>(); 69 71 } 70 72 -
FarmatikoData/FarmatikoData.csproj
r4e72684 ra55ef91 23 23 <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> 24 24 </PackageReference> 25 <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> 25 26 <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" /> 26 27 </ItemGroup> -
FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.FarmatikoRepoInterfaces; 2 using System;3 2 using System.Linq; 4 using System.Collections.Generic;5 using System.Text;6 3 using FarmatikoData.Models; 7 using Microsoft.EntityFrameworkCore;8 4 9 5 namespace FarmatikoData.FarmatikoRepo … … 21 17 { 22 18 _context.Add(healthFacility); 23 _context.SaveChanges Async();19 _context.SaveChanges(); 24 20 } 25 21 26 public I Enumerable<HealthFacilities> GetAll()22 public IQueryable<HealthFacilities> GetAll() 27 23 { 28 return _context.HealthFacilities.OrderBy(x => x.Name) .ToList();24 return _context.HealthFacilities.OrderBy(x => x.Name); 29 25 } 30 26 27 public void Remove(HealthFacilities healthFacility) 28 { 29 var facility = _context.HealthFacilities.Where(x => x.Name.Equals(healthFacility.Name)); 30 _context.HealthFacilities.Remove((HealthFacilities)facility); 31 } 31 32 } 32 33 } -
FarmatikoData/FarmatikoRepo/HealthcareWorkerRepository.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.Models; 3 3 using System.Linq; 4 using System.Collections.Generic;5 4 6 5 namespace FarmatikoData.FarmatikoRepo … … 18 17 public void Add(HealthcareWorkers HealthcareWorker) 19 18 { 20 _context. Add(HealthcareWorker);19 _context.HealthcareWorkers.Add(HealthcareWorker); 21 20 _context.SaveChangesAsync(); 22 21 } 23 22 24 public I Enumerable<HealthcareWorkers> GetAll()23 public IQueryable<HealthcareWorkers> GetAll() 25 24 { 26 25 return _context.HealthcareWorkers.OrderBy(x => x.Name); … … 29 28 public void Remove(HealthcareWorkers healthcareWorker) 30 29 { 31 _context.Remove(healthcareWorker); 30 var healthCareWorker = _context.HealthcareWorkers.Where(x => x.Name.Equals(healthcareWorker.Name)); 31 _context.HealthcareWorkers.Remove((HealthcareWorkers)healthCareWorker); 32 32 } 33 33 } -
FarmatikoData/FarmatikoRepo/MedicineListRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using Microsoft.EntityFrameworkCore; 2 3 using System.Collections.Generic; 3 4 using System.Linq; … … 17 18 _context.SaveChangesAsync(); 18 19 } 19 public MedicineList CheckMedicine(string Name)20 /*public MedicineList CheckMedicine(string Name) 20 21 { 21 22 return (MedicineList)_context.MedicineLists 22 23 .Where(medicineList => medicineList.Medicine.Name.Contains(Name)) 23 .OrderBy(x => x.Medicine.Name); 24 } 25 26 public IEnumerable<MedicineList> GetAll() 24 .OrderBy(x => x.Medicine.Name) 25 .Include(x => x.HasMedicine) 26 .Cast<MedicineList>(); 27 }*/ 28 29 public IQueryable<MedicineList> GetAll() 27 30 { 28 31 return _context.MedicineLists.OrderBy(x => x.Medicine.Name); … … 33 36 return (ICollection<MedicineList>)_context.MedicineLists 34 37 .Where(x => x.Medicine.Manufacturer.Contains(Manufacturer)) 35 .OrderBy(x => x.Medicine.Name); 38 .OrderBy(x => x.Medicine.Name) 39 .Cast<ICollection<MedicineList>>(); 36 40 } 37 41 public ICollection<MedicineList> GetByName(string Name) … … 39 43 return (ICollection<MedicineList>)_context.MedicineLists 40 44 .Where(x => x.Medicine.Name.Contains(Name)) 41 .OrderBy(x => x.Medicine.Name); 45 .OrderBy(x => x.Medicine.Name) 46 .Cast<ICollection<MedicineList>>(); 42 47 } 43 48 44 49 public void Remove(MedicineList medicineList) 45 50 { 46 var list = (MedicineList)_context.MedicineLists.Where(x => x. Equals(medicineList));51 var list = (MedicineList)_context.MedicineLists.Where(x => x.Medicine.Equals(medicineList.Medicine)); 47 52 _context.MedicineLists.Remove(list); 48 }49 50 public bool SetHasMedicine(MedicineList medicineList, bool HasMedicine)51 {52 MedicineList medicine = (MedicineList)_context.MedicineLists.Where(x => x.Medicine.Name.Equals(medicineList.Medicine.Name));53 54 if (medicine != null || medicineList != null)55 {56 if (HasMedicine == true)57 {58 medicine.HasMedicine = HasMedicine;59 _context.MedicineLists.Add(medicine);60 _context.SaveChangesAsync();61 return true;62 }63 else64 {65 medicine.HasMedicine = HasMedicine;66 _context.MedicineLists.Add(medicine);67 _context.SaveChangesAsync();68 return true;69 }70 }else71 {72 return false;73 }74 53 } 75 54 } -
FarmatikoData/FarmatikoRepo/MedicineRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.FarmatikoRepoInterfaces; 2 2 using FarmatikoData.Models; 3 using System .Collections.Generic;3 using System; 4 4 using System.Linq; 5 5 … … 15 15 public void Add(Medicine Medicine) 16 16 { 17 _context. Add(Medicine);17 _context.Medicines.Add(Medicine); 18 18 _context.SaveChangesAsync(); 19 19 } 20 20 21 public I Enumerable<Medicine> GetAll()21 public IQueryable<Medicine> GetAll() 22 22 { 23 23 return _context.Medicines.OrderBy(x => x.Name); 24 24 } 25 25 26 public I Enumerable<Medicine> GetByManufacturer(string Manufacturer)26 public IQueryable<Medicine> GetByManufacturer(string Manufacturer) 27 27 { 28 28 return _context.Medicines.Where(x => x.Name.Contains(Manufacturer)).OrderBy(x => x.Manufacturer); 29 29 } 30 30 31 public I Enumerable<Medicine> GetByName(string Name)31 public IQueryable<Medicine> GetByName(string Name) 32 32 { 33 return _context.Medicines.Where(medicine => medicine.Name ==Name);33 return _context.Medicines.Where(medicine => medicine.Name.Contains(Name)).OrderBy(x => x.Name); 34 34 } 35 35 -
FarmatikoData/FarmatikoRepo/PandemicRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.FarmatikoRepoInterfaces; 2 2 using FarmatikoData.Models; 3 using Microsoft.EntityFrameworkCore;4 using System;5 using System.Collections.Generic;6 3 using System.Linq; 7 using System.Text;8 4 9 5 namespace FarmatikoData.FarmatikoRepo … … 24 20 } 25 21 26 public I Enumerable<Pandemic> GetAll()22 public IQueryable<Pandemic> GetAll() 27 23 { 28 return _context.Pandemics ;24 return _context.Pandemics.OrderBy(x => x.Name); 29 25 } 30 26 -
FarmatikoData/FarmatikoRepo/PharmacyHeadRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.FarmatikoRepoInterfaces; 2 2 using FarmatikoData.Models; 3 using System;4 using System.Collections.Generic;5 3 using System.Linq; 6 using System.Text;7 4 8 5 namespace FarmatikoData.FarmatikoRepo … … 45 42 public void Remove(PharmacyHead pharmacyHead, string Name) 46 43 { 47 var phead = (PharmacyHead)_context.PharmacyHeads.Where(phead => phead.Name.Equals(Name)) ;44 var phead = (PharmacyHead)_context.PharmacyHeads.Where(phead => phead.Name.Equals(Name)).FirstOrDefault(); 48 45 _context.PharmacyHeads.Remove(phead); 49 46 _context.SaveChangesAsync(); -
FarmatikoData/FarmatikoRepo/PharmacyRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.FarmatikoRepoInterfaces; 2 2 using FarmatikoData.Models; 3 using System;4 3 using System.Collections.Generic; 5 4 using System.Linq; 6 using System.Text;7 5 8 6 namespace FarmatikoData.FarmatikoRepo … … 23 21 } 24 22 //Just for users 25 public I Enumerable<Pharmacy> GetAll()23 public IQueryable<Pharmacy> GetAll() 26 24 { 27 25 return _context.Pharmacies.OrderBy(x => x.Name); … … 36 34 pharmacy.Location, 37 35 pharmacy.WorkAllTime 38 }) ;36 }).OrderBy(x => x.Name); 39 37 } 40 38 41 39 public void Remove(Pharmacy pharmacy) 42 40 { 43 var pharma = _context.Pharmacies.Where(pharm => pharm. Equals(pharmacy));41 var pharma = _context.Pharmacies.Where(pharm => pharm.Name.Equals(pharmacy.Name)).Cast<Pharmacy>(); 44 42 _context.Pharmacies.Remove((Pharmacy)pharma); 45 43 _context.SaveChangesAsync(); … … 48 46 public void UpdatePharmacy(Pharmacy pharmacy, string Name) 49 47 { 50 var oldPharmacy = _context.Pharmacies.Where(pharma => pharma.Name.Equals(Name)) ;48 var oldPharmacy = _context.Pharmacies.Where(pharma => pharma.Name.Equals(Name)).Cast<Pharmacy>(); 51 49 _context.Pharmacies.Remove((Pharmacy)oldPharmacy); 52 50 _context.Pharmacies.Add(pharmacy); -
FarmatikoData/FarmatikoRepoInterfaces/IHealthFacilityRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoData.FarmatikoRepoInterfaces … … 8 6 public interface IHealthFacilityRepository 9 7 { 10 I Enumerable<HealthFacilities> GetAll();8 IQueryable<HealthFacilities> GetAll(); 11 9 void Add(HealthFacilities healthFacility); 10 void Remove(HealthFacilities healthFacility); 12 11 } 13 12 } -
FarmatikoData/FarmatikoRepoInterfaces/IHealthcareWorkerRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoData.FarmatikoRepoInterfaces … … 8 6 public interface IHealthcareWorkerRepository 9 7 { 10 I Enumerable<HealthcareWorkers> GetAll();8 IQueryable<HealthcareWorkers> GetAll(); 11 9 void Add(HealthcareWorkers HealthcareWorker); 12 10 void Remove(HealthcareWorkers healthcareWorker); -
FarmatikoData/FarmatikoRepoInterfaces/IMedicineListRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 2 using System.Collections.Generic; 3 using System.Linq; 3 4 4 5 namespace FarmatikoData.FarmatikoRepo … … 8 9 void Add(MedicineList medicineList); 9 10 void Remove(MedicineList medicineList); 10 IEnumerable<MedicineList> GetAll(); 11 //Not needed, maybe later 12 /*MedicineList CheckMedicine(MedicineList medicineList, bool HasMedicine); 13 public MedicineList CheckMedicine(string Name);*/ 11 IQueryable<MedicineList> GetAll(); 12 /*MedicineList CheckMedicine(MedicineList medicineList, bool HasMedicine);*/ 13 //public MedicineList CheckMedicine(string Name); 14 14 ICollection<MedicineList> GetByName(string Name); 15 15 ICollection<MedicineList> GetByManufacturer(string Manufacturer); 16 bool SetHasMedicine(MedicineList medicineList, bool HasMedicine); 16 //bool SetHasMedicine(MedicineList medicineList, bool HasMedicine); 17 //void SetHasMedicine(MedicineList medicineList); 17 18 } 18 19 } -
FarmatikoData/FarmatikoRepoInterfaces/IMedicineRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoData.FarmatikoRepoInterfaces … … 8 6 public interface IMedicineRepository 9 7 { 10 I Enumerable<Medicine> GetAll();11 I Enumerable<Medicine> GetByName(string Name);8 IQueryable<Medicine> GetAll(); 9 IQueryable<Medicine> GetByName(string Name); 12 10 void Add(Medicine medicine); 13 11 void Remove(string medicine); 14 I Enumerable<Medicine> GetByManufacturer(string Manufacturer);12 IQueryable<Medicine> GetByManufacturer(string Manufacturer); 15 13 16 14 } -
FarmatikoData/FarmatikoRepoInterfaces/IPandemicRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoData.FarmatikoRepoInterfaces … … 8 6 public interface IPandemicRepository 9 7 { 10 I Enumerable<Pandemic> GetAll();8 IQueryable<Pandemic> GetAll(); 11 9 void Add(Pandemic pandemic); 12 10 void Remove(Pandemic pandemic); -
FarmatikoData/FarmatikoRepoInterfaces/IPharmacyHeadRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System;3 using System.Collections.Generic;4 2 using System.Linq; 5 using System.Text;6 3 7 4 namespace FarmatikoData.FarmatikoRepoInterfaces -
FarmatikoData/FarmatikoRepoInterfaces/IPharmacyRepository.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System;3 2 using System.Collections.Generic; 4 using System. Text;3 using System.Linq; 5 4 6 5 namespace FarmatikoData.FarmatikoRepoInterfaces … … 10 9 void Add(Pharmacy pharmacy); 11 10 ICollection<Pharmacy> GetPharmacies(); 12 I Enumerable<Pharmacy> GetAll();11 IQueryable<Pharmacy> GetAll(); 13 12 void Remove(Pharmacy pharmacy); 14 13 void UpdatePharmacy(Pharmacy pharmacy, string Name); -
FarmatikoData/Models/HealthFacilities.cs
r4e72684 ra55ef91 1 1 using System; 2 using System.Collections; 2 3 using System.Collections.Generic; 3 4 using System.ComponentModel.DataAnnotations; -
FarmatikoServices/FarmatikoServiceInterfaces/IHealthFacilityService.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoData … … 8 6 public interface IHealthFacilityService 9 7 { 10 I Enumerable<HealthFacilities> GetAll();8 IQueryable<HealthFacilities> GetAll(); 11 9 void Add(HealthFacilities healthFacility); 10 void Remove(HealthFacilities healthFacility); 12 11 } 13 12 } -
FarmatikoServices/FarmatikoServiceInterfaces/IHealthcareWorkerService.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoServices.FarmatikoServiceInterfaces … … 8 6 public interface IHealthcareWorkerService 9 7 { 10 I Enumerable<HealthcareWorkers> GetAll();8 IQueryable<HealthcareWorkers> GetAll(); 11 9 void Add(HealthcareWorkers healthcareWorker); 12 //Not needed 13 /*void Remove(HealthcareWorkers healthcareWorker);*/ 10 void Remove(HealthcareWorkers healthcareWorker); 14 11 } 15 12 } -
FarmatikoServices/FarmatikoServiceInterfaces/IMedicineListService.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 2 using System.Collections.Generic; 3 using System.Linq; 3 4 4 5 namespace FarmatikoServices.FarmatikoServiceInterfaces … … 6 7 public interface IMedicineListService 7 8 { 8 I Enumerable<MedicineList> GetAll();9 boolSetHasMedicine(MedicineList medicineList, bool HasMedicine);9 IQueryable<MedicineList> GetAll(); 10 //SetHasMedicine(MedicineList medicineList, bool HasMedicine); 10 11 ICollection<MedicineList> GetByName(string Name); 11 12 ICollection<MedicineList> GetByManufacturer(string Manufacturer); 13 void Add(MedicineList medicineList); 14 void Remove(MedicineList medicineList); 12 15 } 13 16 } -
FarmatikoServices/FarmatikoServiceInterfaces/IMedicineService.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoServices.FarmatikoServiceInterfaces … … 8 6 public interface IMedicineService 9 7 { 10 I Enumerable<Medicine> GetAll();8 IQueryable<Medicine> GetAll(); 11 9 void Add(Medicine medicine); 12 10 void Remove(string Medicine); 13 I Enumerable<Medicine> GetByName(string Name);14 I Enumerable<Medicine> GetByManufacturer(string Manufacturer);11 IQueryable<Medicine> GetByName(string Name); 12 IQueryable<Medicine> GetByManufacturer(string Manufacturer); 15 13 } 16 14 } -
FarmatikoServices/FarmatikoServiceInterfaces/IPandemicService.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Linq; 5 3 6 4 namespace FarmatikoServices.FarmatikoServiceInterfaces … … 9 7 { 10 8 void Add(Pandemic pandemic); 11 I Enumerable<Pandemic> GetAll();9 IQueryable<Pandemic> GetAll(); 12 10 void Remove(Pandemic pandemic); 13 11 } -
FarmatikoServices/FarmatikoServiceInterfaces/IPharmacyHeadService.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System;3 using System.Collections.Generic;4 2 using System.Linq; 5 using System.Text;6 3 7 4 namespace FarmatikoServices.FarmatikoServiceInterfaces -
FarmatikoServices/FarmatikoServiceInterfaces/IPharmacyService.cs
r4e72684 ra55ef91 1 1 using FarmatikoData.Models; 2 using System;3 2 using System.Collections.Generic; 4 using System. Text;3 using System.Linq; 5 4 6 5 namespace FarmatikoServices.FarmatikoServiceInterfaces … … 10 9 void Add(Pharmacy pharmacy); 11 10 ICollection<Pharmacy> GetPharmacies(); 12 I Enumerable<Pharmacy> GetAll();11 IQueryable<Pharmacy> GetAll(); 13 12 void Remove(Pharmacy pharmacy); 14 13 void UpdatePharmacy(Pharmacy pharmacy, string Name); -
FarmatikoServices/FarmatikoServices.csproj
r4e72684 ra55ef91 7 7 <ItemGroup> 8 8 <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> 9 <PackageReference Include="RestSharp" Version="106.11.4" /> 9 10 </ItemGroup> 10 11 -
FarmatikoServices/Services/HealthFacilityService.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.FarmatikoRepoInterfaces; 3 3 using FarmatikoData.Models; 4 using System .Collections.Generic;4 using System; 5 5 using System.Linq; 6 6 … … 18 18 public void Add(HealthFacilities healthFacility) 19 19 { 20 _healthFacilityRepository.Add(healthFacility); 20 try 21 { 22 if (healthFacility != null) 23 _healthFacilityRepository.Add(healthFacility); 24 } 25 catch (Exception e) 26 { 27 e = new Exception("Can't Add health facility is null"); 28 throw e; 29 } 21 30 } 22 31 23 public I Enumerable<HealthFacilities> GetAll()32 public IQueryable<HealthFacilities> GetAll() 24 33 { 25 34 return _healthFacilityRepository.GetAll(); 26 35 } 36 37 public void Remove(HealthFacilities healthFacility) 38 { 39 try 40 { 41 if (healthFacility != null) 42 _healthFacilityRepository.Remove(healthFacility); 43 } 44 catch(Exception e) 45 { 46 e = new Exception("Can't Remove health facility is null"); 47 throw e; 48 } 49 } 27 50 } 28 51 } -
FarmatikoServices/Services/HealthcareWorkerService.cs
r4e72684 ra55ef91 1 using FarmatikoData.FarmatikoRepo; 2 using FarmatikoData.FarmatikoRepoInterfaces; 1 using FarmatikoData.FarmatikoRepoInterfaces; 3 2 using FarmatikoData.Models; 4 3 using FarmatikoServices.FarmatikoServiceInterfaces; 5 4 using System; 6 using System.Collections.Generic; 7 using System.Text; 5 using System.Linq; 8 6 9 7 namespace FarmatikoServices.Services … … 18 16 public void Add(HealthcareWorkers healthcareWorker) 19 17 { 20 _healthcareWorkerRepo.Add(healthcareWorker); 18 try 19 { 20 if (healthcareWorker != null) 21 _healthcareWorkerRepo.Add(healthcareWorker); 22 } 23 catch (Exception e) 24 { 25 e = new Exception("Can't Add healthcare worker is null"); 26 throw e; 27 } 21 28 } 22 29 23 public I Enumerable<HealthcareWorkers> GetAll()30 public IQueryable<HealthcareWorkers> GetAll() 24 31 { 25 32 return _healthcareWorkerRepo.GetAll(); 26 33 } 34 35 public void Remove(HealthcareWorkers healthcareWorker) 36 { 37 try 38 { 39 if (healthcareWorker != null) 40 _healthcareWorkerRepo.Remove(healthcareWorker); 41 } 42 catch (Exception e) 43 { 44 e = new Exception("Can't Remove healthcare worker is null"); 45 throw e; 46 } 47 } 27 48 } 28 49 } -
FarmatikoServices/Services/MedicineListService.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 … … 14 16 } 15 17 16 public IEnumerable<MedicineList> GetAll() 18 public void Add(MedicineList medicineList) 19 { 20 try 21 { 22 if (medicineList != null) 23 _medicineListRepository.Add(medicineList); 24 } 25 catch (Exception e) 26 { 27 e = new Exception("Can't add the medicine list is null."); 28 throw e; 29 } 30 } 31 32 public IQueryable<MedicineList> GetAll() 17 33 { 18 34 return _medicineListRepository.GetAll(); … … 21 37 public ICollection<MedicineList> GetByManufacturer(string Manufacturer) 22 38 { 23 return _medicineListRepository.GetByManufacturer(Manufacturer); 39 try 40 { 41 if (Manufacturer != null) 42 { 43 44 return _medicineListRepository.GetByManufacturer(Manufacturer); 45 } 46 } 47 catch (Exception e) 48 { 49 e = new Exception("Can't get name of manufacturer is null"); 50 throw e; 51 } 52 return null; 24 53 } 25 54 26 55 public ICollection<MedicineList> GetByName(string Name) 27 56 { 28 if(Name != null)57 try 29 58 { 30 return _medicineListRepository.GetByName(Name); 59 if (Name != null) 60 { 61 return _medicineListRepository.GetByName(Name); 62 } 63 } 64 catch (Exception e) 65 { 66 e = new Exception("Can't get name is null"); 67 throw e; 31 68 } 32 69 return null; 33 70 } 34 71 35 public bool SetHasMedicine(MedicineList medicineList, bool HasMedicine)72 public void Remove(MedicineList medicineList) 36 73 { 37 if (medicineList != null)74 try 38 75 { 39 _medicineListRepository.SetHasMedicine(medicineList, HasMedicine);40 return true;76 if (medicineList != null) 77 _medicineListRepository.Remove(medicineList); 41 78 } 42 else return false; 79 catch (Exception e) 80 { 81 e = new Exception("Can't remove the medicine list is null."); 82 throw e; 83 } 43 84 } 44 85 } -
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 } -
FarmatikoServices/Services/PandemicService.cs
r4e72684 ra55ef91 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 4 using System; 5 using System. Collections.Generic;5 using System.Linq; 6 6 7 7 namespace FarmatikoServices.Services … … 17 17 public void Add(Pandemic pandemic) 18 18 { 19 _pandemicRepository.Add(pandemic); 19 try 20 { 21 if (pandemic != null) 22 { 23 _pandemicRepository.Add(pandemic); 24 } 25 } 26 catch (Exception e) 27 { 28 e = new Exception("Can't add pandemic is null."); 29 throw e; 30 } 20 31 } 21 32 22 public I Enumerable<Pandemic> GetAll()33 public IQueryable<Pandemic> GetAll() 23 34 { 24 35 return _pandemicRepository.GetAll(); … … 27 38 public void Remove(Pandemic pandemic) 28 39 { 29 _pandemicRepository.Remove(pandemic); 40 try 41 { 42 if (pandemic != null) 43 _pandemicRepository.Remove(pandemic); 44 } 45 catch (Exception e) 46 { 47 e = new Exception("Can't remove, pandemic is null."); 48 } 30 49 } 31 50 } -
FarmatikoServices/Services/PharmacyHeadService.cs
r4e72684 ra55ef91 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 4 using System; 5 using System.Collections.Generic;6 5 using System.Linq; 7 using System.Text;8 6 9 7 namespace FarmatikoServices.Services … … 19 17 public void Add(PharmacyHead pharmacyHead) 20 18 { 21 if (pharmacyHead != null)19 try 22 20 { 23 _pharmacyHeadRepository.Add(pharmacyHead); 21 if (pharmacyHead != null) 22 { 23 _pharmacyHeadRepository.Add(pharmacyHead); 24 } 24 25 } 26 catch (Exception e) 27 { 28 e = new Exception("Can't add, pharmacy head is null."); 29 } 30 25 31 } 26 32 27 33 public IQueryable<PharmacyHead> GetAllPharmacies(string NameOfPharmacyHead) 28 34 { 29 if (NameOfPharmacyHead != null)35 if (NameOfPharmacyHead != null) 30 36 { 31 37 IQueryable<PharmacyHead> Pharmacy = _pharmacyHeadRepository.GetAllPharmacies(NameOfPharmacyHead); 32 38 if (Pharmacy != null) 33 {34 39 return Pharmacy; 35 }36 40 } 37 41 return null; … … 40 44 public IQueryable<PharmacyHead> GetPharmacyByName(string Name) 41 45 { 42 if (Name != null)46 if (Name != null) 43 47 { 44 48 IQueryable<PharmacyHead> PharmacyHead = _pharmacyHeadRepository.GetPharmacyByName(Name); … … 51 55 public IQueryable<MedicineList> GetPharmacyMedicines(string NameOfPharmacy) 52 56 { 53 if (NameOfPharmacy != null)57 if (NameOfPharmacy != null) 54 58 { 55 59 IQueryable<MedicineList> Medicines = _pharmacyHeadRepository.GetPharmacyMedicines(NameOfPharmacy); … … 62 66 public void Remove(PharmacyHead pharmacyHead, string Name) 63 67 { 64 if (pharmacyHead != null && Name != null)68 try 65 69 { 66 _pharmacyHeadRepository.Remove(pharmacyHead, Name); 70 if (Name != null) 71 { 72 _pharmacyHeadRepository.Remove(pharmacyHead, Name); 73 } 67 74 } 75 catch (Exception e) 76 { 77 e = new Exception("Can't remove, name of pharmacy head is null."); 78 } 79 68 80 } 69 81 } -
FarmatikoServices/Services/PharmacyService.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 … … 15 17 public void Add(Pharmacy pharmacy) 16 18 { 17 if(pharmacy != null)19 try 18 20 { 19 _pharmacyRepository.Add(pharmacy); 21 if (pharmacy != null) 22 { 23 _pharmacyRepository.Add(pharmacy); 24 } 20 25 } 26 catch (Exception e) 27 { 28 e = new Exception("Can't add, pharmacy has null value."); 29 throw e; 30 } 31 21 32 } 22 33 23 public I Enumerable<Pharmacy> GetAll()34 public IQueryable<Pharmacy> GetAll() 24 35 { 25 36 return _pharmacyRepository.GetAll(); … … 33 44 public void Remove(Pharmacy pharmacy) 34 45 { 35 _pharmacyRepository.Remove(pharmacy); 46 try 47 { 48 if (pharmacy != null) 49 _pharmacyRepository.Remove(pharmacy); 50 } 51 catch (Exception e) 52 { 53 e = new Exception("Can't remove, pharmacy has null value."); 54 throw e; 55 } 36 56 } 37 57 38 58 public void UpdatePharmacy(Pharmacy pharmacy, string Name) 39 59 { 40 if(pharmacy != null && Name != null)60 try 41 61 { 42 _pharmacyRepository.UpdatePharmacy(pharmacy, Name); 62 if (pharmacy != null && Name != null) 63 { 64 _pharmacyRepository.UpdatePharmacy(pharmacy, Name); 65 } 43 66 } 67 catch (Exception e) 68 { 69 e = new Exception("Can not update pharmacy, has null value."); 70 throw e; 71 } 72 44 73 } 45 74 }
Note:
See TracChangeset
for help on using the changeset viewer.