source: FarmatikoServices/Services/PHService.cs@ 1454207

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.3 KB
Line 
1using FarmatikoData.FarmatikoRepoInterfaces;
2using FarmatikoData.Models;
3using FarmatikoServices.FarmatikoServiceInterfaces;
4using System;
5using System.Collections.Generic;
6using System.Linq;
7using System.Text;
8using System.Threading.Tasks;
9
10namespace FarmatikoServices.Services
11{
12 public class PHService : IPHService
13 {
14 private readonly IPHRepo _iPHRepo;
15 public PHService(IPHRepo iPHRepo)
16 {
17 _iPHRepo = iPHRepo;
18 }
19
20 public async Task ClaimPharmacy(RequestPharmacyHead pharmacy)
21 {
22 await _iPHRepo.ClaimPharmacy(pharmacy);
23 }
24
25 public Task<IQueryable<PharmacyHead>> GetPharmacyHeadInfo(string Token)
26 {
27 throw new NotImplementedException();
28 }
29
30 public async Task<int> Login(PharmacyHead pharmacyHead)
31 {
32 var PHead = await Task.Run(() => _iPHRepo.GetPharmacyHead(pharmacyHead));
33 if (PHead.Password.Equals(pharmacyHead.Password))
34 return PHead.Id;
35 return -1;
36 }
37
38
39 public async Task UpdatePharmacyHead(PharmacyHead pharmacyHead)
40 {
41 if (pharmacyHead != null)
42 await _iPHRepo.UpdatePharmacyHead(pharmacyHead);
43 else throw new Exception("PharmacyHead has a null value.");
44 }
45 }
46}
Note: See TracBrowser for help on using the repository browser.