Ignore:
Timestamp:
07/29/20 20:02:58 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
a55ef91
Parents:
de18858
Message:

Add services

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoData/FarmatikoRepo/MedicineRepository.cs

    rde18858 r4e72684  
    11using FarmatikoData.FarmatikoRepoInterfaces;
    22using FarmatikoData.Models;
    3 using Microsoft.EntityFrameworkCore;
    4 using System;
    53using System.Collections.Generic;
    64using System.Linq;
    7 using System.Text;
    85
    96namespace FarmatikoData.FarmatikoRepo
     
    2421        public IEnumerable<Medicine> GetAll()
    2522        {
    26             return _context.Medicines.Include(medicine => medicine.Name).Include(medicine => medicine.Strength).Include(medicine => medicine.Form);
     23            return _context.Medicines.OrderBy(x => x.Name);
    2724        }
    2825
     
    3431        public IEnumerable<Medicine> GetByName(string Name)
    3532        {
    36             return (IEnumerable<Medicine>)_context.Medicines.Where(medicine => medicine.Name == Name);
     33            return _context.Medicines.Where(medicine => medicine.Name == Name);
    3734        }
    3835
     
    4037        {
    4138            Medicine med = (Medicine)_context.Medicines.Where(medicine => medicine.Name.Equals(medicine));
    42             _context.Remove(med);
     39            _context.Medicines.Remove(med);
    4340        }
    4441    }
Note: See TracChangeset for help on using the changeset viewer.