Changeset 1454207 for FarmatikoData/FarmatikoRepo
- Timestamp:
- 10/01/20 03:17:09 (4 years ago)
- Branches:
- master
- Children:
- 6f203af
- Parents:
- 5d02859
- Location:
- FarmatikoData/FarmatikoRepo
- Files:
-
- 2 added
- 7 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoRepo/Repository.cs
r5d02859 r1454207 14 14 } 15 15 //GET 16 public async Task<IQueryable<HealthcareWorker s>> GetAllWorkers()16 public async Task<IQueryable<HealthcareWorker>> GetAllWorkers() 17 17 { 18 18 var Workers = await Task.Run(() => _context.HealthcareWorkers.Take(10)); … … 20 20 } 21 21 22 public async Task<IQueryable<HealthFacilit ies>> GetFacilities()22 public async Task<IQueryable<HealthFacility>> GetFacilities() 23 23 { 24 24 var Facilities = await Task.Run(() => _context.HealthFacilities.Take(10)); … … 26 26 } 27 27 28 public async Task<HealthFacilit ies> GetFacility(int Id)28 public async Task<HealthFacility> GetFacility(int Id) 29 29 { 30 30 var Facility = await _context.HealthFacilities.FindAsync(Id); … … 62 62 } 63 63 64 public async Task<HealthcareWorker s> GetWorker(int id)64 public async Task<HealthcareWorker> GetWorker(int id) 65 65 { 66 66 var Worker = await _context.HealthcareWorkers.FindAsync(id); … … 68 68 } 69 69 70 public async Task<IQueryable<HealthFacilit ies>> SearchFacilities(string query)70 public async Task<IQueryable<HealthFacility>> SearchFacilities(string query) 71 71 { 72 72 var SearchQuery = await Task.Run(() => _context.HealthFacilities … … 95 95 } 96 96 97 public async Task<IQueryable<HealthcareWorker s>> SearchWorkers(string query)97 public async Task<IQueryable<HealthcareWorker>> SearchWorkers(string query) 98 98 { 99 99 var SearchQuery = await Task.Run(() => _context.HealthcareWorkers … … 103 103 return SearchQuery; 104 104 } 105 public async Task<HealthFacility> GetFacilityJSON(string healthFacility) 106 { 107 var Facility = await Task.Run(() => _context.HealthFacilities.Where(x => x.Name.Equals(healthFacility)).FirstOrDefault()); 108 return Facility; 109 } 105 110 106 111 //POST 107 112 108 public async Task AddWorker(HealthcareWorker sWorker)113 public async Task AddWorker(HealthcareWorker Worker) 109 114 { 110 115 await Task.Run(() => _context.HealthcareWorkers.Add(Worker)); … … 112 117 } 113 118 114 public async Task AddFacility(HealthFacilit ieshealthFacility)119 public async Task AddFacility(HealthFacility healthFacility) 115 120 { 116 121 await Task.Run(() => _context.HealthFacilities.Add(healthFacility)); … … 141 146 await _context.SaveChangesAsync(); 142 147 } 148 149 public async Task UpdateFacility(HealthFacility healthFacility) 150 { 151 var Facility = await Task.Run(() => _context.HealthFacilities.Where(x => x.Id == healthFacility.Id).FirstOrDefault()); 152 Facility.Address = healthFacility.Address; 153 Facility.Email = healthFacility.Email; 154 Facility.Municipality = healthFacility.Municipality; 155 Facility.Name = healthFacility.Name; 156 Facility.Phone = healthFacility.Phone; 157 Facility.Type = healthFacility.Type; 158 await _context.SaveChangesAsync(); 159 } 160 161 public async Task RemoveMedicine(Medicine medicine) 162 { 163 await Task.Run(() => _context.Medicines.Remove(medicine)); 164 await _context.SaveChangesAsync(); 165 } 166 167 public async Task UpdatePandemic(Pandemic pandemic) 168 { 169 var Pandemic = await Task.Run(() => _context.Pandemics.Where(x => x.Id == pandemic.Id).FirstOrDefault()); 170 Pandemic.ActiveGlobal = pandemic.ActiveGlobal; 171 Pandemic.ActiveMK = pandemic.ActiveMK; 172 Pandemic.DeathsGlobal = pandemic.DeathsGlobal; 173 Pandemic.DeathsMK = pandemic.DeathsMK; 174 Pandemic.Name = pandemic.Name; 175 Pandemic.NewMK = pandemic.NewMK; 176 Pandemic.TotalGlobal = pandemic.TotalGlobal; 177 Pandemic.TotalMK = pandemic.TotalMK; 178 await _context.SaveChangesAsync(); 179 } 180 181 public async Task RemovePharmacy(Pharmacy pharmacy) 182 { 183 await Task.Run(() => _context.Pharmacies.Remove(pharmacy)); 184 await _context.SaveChangesAsync(); 185 } 186 //ke vidime 187 public Task UpdateWorker(HealthcareWorker worker) 188 { 189 throw new System.NotImplementedException(); 190 } 191 192 public async Task UpadatePharmacy(Pharmacy pharmacy) 193 { 194 var Pharmacy = await Task.Run(() => _context.Pharmacies.Where(x => x.Id == pharmacy.Id).FirstOrDefault()); 195 Pharmacy.Name = pharmacy.Name; 196 Pharmacy.Location = pharmacy.Location; 197 Pharmacy.WorkAllTime = pharmacy.WorkAllTime; 198 Pharmacy.Address = pharmacy.Address; 199 await _context.SaveChangesAsync(); 200 } 201 //ke vidime 202 public Task UpdateMedicine(Medicine medicine) 203 { 204 throw new System.NotImplementedException(); 205 } 206 207 public async Task RemovePharmacyHead(PharmacyHead pharmacyHead) 208 { 209 var PHead = await Task.Run(() => _context.PharmacyHeads.Where(x => x.Id == pharmacyHead.Id).FirstOrDefault()); 210 PHead.DeletedOn = pharmacyHead.DeletedOn; 211 await _context.SaveChangesAsync(); 212 } 213 143 214 } 144 215 }
Note:
See TracChangeset
for help on using the changeset viewer.