Ignore:
Timestamp:
10/28/20 22:06:48 (2 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
993189e
Parents:
1454207
Message:

Change methods & add error controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoData/FarmatikoRepo/Repository.cs

    r1454207 r6f203af  
    11using FarmatikoData.FarmatikoRepoInterfaces;
    22using FarmatikoData.Models;
     3using Microsoft.EntityFrameworkCore;
     4using System;
     5using System.Collections.Generic;
    36using System.Linq;
    47using System.Threading.Tasks;
     
    1417        }
    1518        //GET
    16         public async Task<IQueryable<HealthcareWorker>> GetAllWorkers()
     19        public async Task<IEnumerable<HealthcareWorker>> GetAllWorkers()
    1720        {
    1821            var Workers = await Task.Run(() => _context.HealthcareWorkers.Take(10));
     
    2023        }
    2124
    22         public async Task<IQueryable<HealthFacility>> GetFacilities()
     25        public async Task<IEnumerable<HealthFacility>> GetFacilities()
    2326        {
    2427            var Facilities = await Task.Run(() => _context.HealthFacilities.Take(10));
     
    3841        }
    3942
    40         public async Task<IQueryable<Medicine>> GetMedicines()
     43        public async Task<IEnumerable<Medicine>> GetMedicines()
    4144        {
    4245            var Medicines = await Task.Run(() => _context.Medicines.Take(10));
     
    5053        }
    5154
    52         public async Task<IQueryable<Pharmacy>> GetPharmacies()
     55        public async Task<IEnumerable<Pharmacy>> GetPharmacies()
    5356        {
    5457            var Pharmacies = await Task.Run(() => _context.Pharmacies.Take(10));
     
    6871        }
    6972
    70         public async Task<IQueryable<HealthFacility>> SearchFacilities(string query)
     73        public async Task<IEnumerable<HealthFacility>> SearchFacilities(string query)
    7174        {
    7275            var SearchQuery = await Task.Run(() => _context.HealthFacilities
     
    7780        }
    7881
    79         public async Task<IQueryable<Medicine>> SearchMedicines(string query)
     82        public async Task<IEnumerable<Medicine>> SearchMedicines(string query)
    8083        {
    8184            var SearchQuery = await Task.Run(() => _context.Medicines
     
    8689        }
    8790
    88         public async Task<IQueryable<Pharmacy>> SearchPharmacies(string query)
     91        public async Task<IEnumerable<Pharmacy>> SearchPharmacies(string query)
    8992        {
    9093            var SearchQuery = await Task.Run(() => _context.Pharmacies
     
    9598        }
    9699
    97         public async Task<IQueryable<HealthcareWorker>> SearchWorkers(string query)
     100        public async Task<IEnumerable<HealthcareWorker>> SearchWorkers(string query)
    98101        {
    99102            var SearchQuery = await Task.Run(() => _context.HealthcareWorkers
     
    184187            await _context.SaveChangesAsync();
    185188        }
    186         //ke vidime
     189        //not impl
    187190        public Task UpdateWorker(HealthcareWorker worker)
    188191        {
     
    205208        }
    206209
    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;
     210        public async Task RemovePharmacyHead(int Id)
     211        {
     212            var PHead = await _context.PharmacyHeads.Where(x => x.Id == Id).FirstOrDefaultAsync();
     213            PHead.DeletedOn = DateTime.UtcNow;
    211214            await _context.SaveChangesAsync();
    212215        }
Note: See TracChangeset for help on using the changeset viewer.