Last change
on this file since 1454207 was 1454207, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago |
Change structure, Add repo, services & controllers
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
2 | using FarmatikoData.Models;
|
---|
3 | using System;
|
---|
4 | using System.Collections.Generic;
|
---|
5 | using System.Linq;
|
---|
6 | using System.Text;
|
---|
7 | using System.Threading.Tasks;
|
---|
8 |
|
---|
9 | namespace FarmatikoData.FarmatikoRepo
|
---|
10 | {
|
---|
11 | public class PHRepo : IPHRepo
|
---|
12 | {
|
---|
13 | private readonly FarmatikoDataContext _context;
|
---|
14 | public PHRepo(FarmatikoDataContext context)
|
---|
15 | {
|
---|
16 | _context = context;
|
---|
17 | }
|
---|
18 |
|
---|
19 | public async Task ClaimPharmacy(RequestPharmacyHead pharmacy)
|
---|
20 | {
|
---|
21 | await Task.Run(() => _context.PHRequests.Add(pharmacy));
|
---|
22 | await _context.SaveChangesAsync();
|
---|
23 | }
|
---|
24 |
|
---|
25 | public async Task<PharmacyHead> GetPharmacyHead(PharmacyHead pharmacyHead)
|
---|
26 | {
|
---|
27 | var Phead = await Task.Run(() => _context.PharmacyHeads.Where(x => x.Email.Equals(pharmacyHead.Email)).FirstOrDefault());
|
---|
28 | return Phead;
|
---|
29 | }
|
---|
30 |
|
---|
31 | public async Task<IQueryable<PharmacyHead>> GetPharmacyHeadInfo()
|
---|
32 | {
|
---|
33 | var PHeadInfo = await Task.Run(() => _context.PharmacyHeads.Take(10));
|
---|
34 | return PHeadInfo;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public async Task UpdatePharmacyHead(PharmacyHead pharmacyHead)
|
---|
38 | {
|
---|
39 | var EditedPHead = await Task.Run(() => _context.PharmacyHeads.Where(x => x.Id == pharmacyHead.Id).FirstOrDefault());
|
---|
40 | EditedPHead.Email = pharmacyHead.Email;
|
---|
41 | EditedPHead.Name = pharmacyHead.Name;
|
---|
42 | EditedPHead.Password = pharmacyHead.Password;
|
---|
43 | EditedPHead.MedicineLists = pharmacyHead.MedicineLists;
|
---|
44 | EditedPHead.PharmaciesList = pharmacyHead.PharmaciesList;
|
---|
45 | await _context.SaveChangesAsync();
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.