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/MedicineRepository.cs

    r4e72684 ra55ef91  
    11using FarmatikoData.FarmatikoRepoInterfaces;
    22using FarmatikoData.Models;
    3 using System.Collections.Generic;
     3using System;
    44using System.Linq;
    55
     
    1515        public void Add(Medicine Medicine)
    1616        {
    17             _context.Add(Medicine);
     17            _context.Medicines.Add(Medicine);
    1818            _context.SaveChangesAsync();
    1919        }
    2020
    21         public IEnumerable<Medicine> GetAll()
     21        public IQueryable<Medicine> GetAll()
    2222        {
    2323            return _context.Medicines.OrderBy(x => x.Name);
    2424        }
    2525
    26         public IEnumerable<Medicine> GetByManufacturer(string Manufacturer)
     26        public IQueryable<Medicine> GetByManufacturer(string Manufacturer)
    2727        {
    2828            return _context.Medicines.Where(x => x.Name.Contains(Manufacturer)).OrderBy(x => x.Manufacturer);
    2929        }
    3030
    31         public IEnumerable<Medicine> GetByName(string Name)
     31        public IQueryable<Medicine> GetByName(string Name)
    3232        {
    33             return _context.Medicines.Where(medicine => medicine.Name == Name);
     33            return _context.Medicines.Where(medicine => medicine.Name.Contains(Name)).OrderBy(x => x.Name);
    3434        }
    3535
Note: See TracChangeset for help on using the changeset viewer.