Ignore:
Timestamp:
07/31/20 10:15:02 (3 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
d8fafb8
Parents:
4e72684
Message:

Update & add service

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs

    r4e72684 ra55ef91  
    11using FarmatikoData.FarmatikoRepoInterfaces;
    2 using System;
    32using System.Linq;
    4 using System.Collections.Generic;
    5 using System.Text;
    63using FarmatikoData.Models;
    7 using Microsoft.EntityFrameworkCore;
    84
    95namespace FarmatikoData.FarmatikoRepo
     
    2117        {
    2218            _context.Add(healthFacility);
    23             _context.SaveChangesAsync();
     19            _context.SaveChanges();
    2420        }
    2521
    26         public IEnumerable<HealthFacilities> GetAll()
     22        public IQueryable<HealthFacilities> GetAll()
    2723        {
    28             return _context.HealthFacilities.OrderBy(x => x.Name).ToList();
     24            return _context.HealthFacilities.OrderBy(x => x.Name);
    2925        }
    3026
     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        }
    3132    }
    3233}
Note: See TracChangeset for help on using the changeset viewer.