Changeset d2e69be


Ignore:
Timestamp:
07/27/20 17:10:07 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
ef1219a
Parents:
4b342bb
Message:

Add Route Attribute

Files:
5 added
2 deleted
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/counter/counter.component.html

    r4b342bb rd2e69be  
    1717        </thead>
    1818        <tbody>
    19             <tr *ngFor="let facility of facilities">
     19          <tr *ngFor="let facility of facilities">
    2020            <td>{{ facility.Name }}</td>
    21             <td>{{ facility.Municipality }}</td>
    22             <td>{{ facility.Address }}</td>
    23             <td>{{ facility.Type }}</td>
    24             <td>{{ facility.Email }}</td>
    25             <td>{{ facility.Phone }}</td>
    26             </tr>
     21            <!--
     22  <td>{{ facility.Municipality }}</td>
     23  <td>{{ facility.Address }}</td>
     24  <td>{{ facility.Type }}</td>
     25  <td>{{ facility.Email }}</td>
     26  <td>{{ facility.Phone }}</td>-->
     27            <td>facility.Municipality</td>
     28            <td></td>
     29            <td></td>
     30            <td></td>
     31            <td>
     32             
     33            </td>
     34
     35          </tr>
    2736        </tbody>
    2837    </table>
  • Farmatiko/ClientApp/src/app/counter/counter.component.ts

    r4b342bb rd2e69be  
    1111
    1212  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
    13     http.get<HealthFacilities[]>(baseUrl + 'HealthFacilities').subscribe(result => {
     13    http.get<HealthFacilities[]>(baseUrl + 'HealthFacilities/Get?').subscribe(result => {
    1414      this.facilities = result;
     15      console.log(this.facilities);
    1516    }, error => console.error(error));
    16   } 
     17  }
    1718}
     19/*interface healthFacilities {
     20  Name: string;
     21  Municipality: string;
     22  Address: string;
     23  Type: string;
     24  Email: string;
     25  Phone: string;
     26}*/
     27
  • Farmatiko/Farmatiko.csproj

    r4b342bb rd2e69be  
    3636  <ItemGroup>
    3737    <ProjectReference Include="..\FarmatikoData\FarmatikoData.csproj" />
     38    <ProjectReference Include="..\FarmatikoServices\FarmatikoServices.csproj" />
    3839  </ItemGroup>
    3940
  • Farmatiko/Startup.cs

    r4b342bb rd2e69be  
    88using FarmatikoData;
    99using Microsoft.EntityFrameworkCore;
     10using FarmatikoServices;
     11using FarmatikoData.FarmatikoRepoInterfaces;
     12using FarmatikoData.FarmatikoRepo;
    1013
    1114namespace Farmatiko
     
    3235            services.AddEntityFrameworkNpgsql().AddDbContext<FarmatikoDataContext>(opt => opt.UseNpgsql(connectionString));
    3336
     37            services.AddTransient<IHealthFacilityRepository, HealthFacilityRepository>();
     38            services.AddTransient<IHealthFacilityService, HealthFacilityService>();
    3439        }
    3540
  • FarmatikoData/Base/BaseEntity.cs

    r4b342bb rd2e69be  
    99        public int Id { get; set; }
    1010        public DateTime CreatedOn { get; set; }
     11
    1112        public DateTime DeletedOn { get; set; }
    1213    }
  • FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs

    r4b342bb rd2e69be  
    2626        public IEnumerable<HealthFacilities> GetAll()
    2727        {
    28             return _context.HealthFacilities;
     28            return _context.HealthFacilities.OrderBy(x => x.Name).ToList();
    2929        }
    3030
    31         public HealthFacilities GetByFullName(string FullName)
     31        public IEnumerable<HealthFacilities> GetAllByName(string Name)
    3232        {
    33             return (HealthFacilities)_context.HealthFacilities
    34                 .Where(Facility => Facility.Name == FullName)
    35                 .FirstOrDefault(Facility => Facility.Name == FullName);
     33            Name = Name.ToLower();
     34
     35            return _context.HealthFacilities.Where(x => x.Name.ToLower().Contains(Name)).OrderBy(x => x.Name.ToLower().IndexOf(Name)).ToList();
    3636        }
    3737
    38         public HealthFacilities GetByType(string FacilityType)
     38        IEnumerable<HealthFacilities> IHealthFacilityRepository.GetByType(string Type)
    3939        {
    40             return (HealthFacilities)_context.HealthFacilities
    41                 .Where(FacilityType => FacilityType.Type.Equals(FacilityType))
    42                 .FirstOrDefault(FacilityType => FacilityType.Name.Equals(FacilityType));
     40            return (IEnumerable<HealthFacilities>)_context.HealthFacilities
     41               .Where(type => type.Type.Equals(Type));
    4342        }
    44 
    45         public void Remove(string healthFacility)
    46         {
    47             HealthFacilities Facility = (HealthFacilities)_context.HealthFacilities.Where(healthFacility => healthFacility.Name.Equals(healthFacility));
    48             _context.Remove(Facility);
    49             _context.SaveChangesAsync();
    50         }
    51 
    5243    }
    5344}
  • FarmatikoData/FarmatikoRepoInterfaces/IHealthFacilityRepository.cs

    r4b342bb rd2e69be  
    99    {
    1010        IEnumerable<HealthFacilities> GetAll();
    11         HealthFacilities GetByFullName(string FullName);
    12         HealthFacilities GetByType(string FacilityType);
     11        IEnumerable<HealthFacilities> GetByType(string Type);
    1312        void Add(HealthFacilities healthFacility);
    14         void Remove(string healthFacility);
     13        IEnumerable<HealthFacilities> GetAllByName(string Name);
    1514    }
    1615}
  • FarmatikoData/Migrations/20200722131856_Initial migration.cs

    r4b342bb rd2e69be  
    1515                    Id = table.Column<int>(nullable: false)
    1616                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    17                     CreatedOn = table.Column<DateTime>(nullable: false),
    18                     DeletedOn = table.Column<DateTime>(nullable: false),
     17                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     18                    DeletedOn = table.Column<DateTime>(nullable: true),
    1919                    Name = table.Column<string>(nullable: false),
    2020                    Municipality = table.Column<string>(nullable: false),
     
    3535                    Id = table.Column<int>(nullable: false)
    3636                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    37                     CreatedOn = table.Column<DateTime>(nullable: false),
    38                     DeletedOn = table.Column<DateTime>(nullable: false),
     37                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     38                    DeletedOn = table.Column<DateTime>(nullable: true),
    3939                    Name = table.Column<string>(nullable: true),
    4040                    TotalMK = table.Column<int>(nullable: false),
     
    5757                    Id = table.Column<int>(nullable: false)
    5858                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    59                     CreatedOn = table.Column<DateTime>(nullable: false),
    60                     DeletedOn = table.Column<DateTime>(nullable: false),
     59                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     60                    DeletedOn = table.Column<DateTime>(nullable: true),
    6161                    Name = table.Column<string>(nullable: false),
    6262                    Branch = table.Column<string>(nullable: false),
     
    8181                    Id = table.Column<int>(nullable: false)
    8282                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    83                     CreatedOn = table.Column<DateTime>(nullable: false),
    84                     DeletedOn = table.Column<DateTime>(nullable: false),
     83                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     84                    DeletedOn = table.Column<DateTime>(nullable: true),
    8585                    Name = table.Column<string>(nullable: true),
    8686                    Strength = table.Column<string>(nullable: true),
     
    103103                    Id = table.Column<int>(nullable: false)
    104104                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    105                     CreatedOn = table.Column<DateTime>(nullable: false),
    106                     DeletedOn = table.Column<DateTime>(nullable: false),
     105                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     106                    DeletedOn = table.Column<DateTime>(nullable: true),
    107107                    PharmacyMedicinesId = table.Column<int>(nullable: true),
    108108                    PharmacyId = table.Column<int>(nullable: true),
     
    122122                    Id = table.Column<int>(nullable: false)
    123123                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    124                     CreatedOn = table.Column<DateTime>(nullable: false),
    125                     DeletedOn = table.Column<DateTime>(nullable: false),
     124                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     125                    DeletedOn = table.Column<DateTime>(nullable: true),
    126126                    MedicinesId = table.Column<int>(nullable: true),
    127127                    HasMedicine = table.Column<bool>(nullable: false),
     
    151151                    Id = table.Column<int>(nullable: false)
    152152                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
    153                     CreatedOn = table.Column<DateTime>(nullable: false),
    154                     DeletedOn = table.Column<DateTime>(nullable: false),
     153                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
     154                    DeletedOn = table.Column<DateTime>(nullable: true),
    155155                    Name = table.Column<string>(nullable: true),
    156156                    Location = table.Column<string>(nullable: true),
  • FarmatikoServices/FarmatikoServiceInterfaces/IHealthcareWorkerService.cs

    r4b342bb rd2e69be  
    11using FarmatikoData.Models;
    2 using System;
    32using System.Collections.Generic;
    4 using System.Text;
    53
    64namespace FarmatikoData.FarmatikoServiceInterfaces
    75{
    8     public interface IHealthcareWorkersService
     6    public interface IHealthcareWorkerService
    97    {
    108        IEnumerable<HealthcareWorkers> GetAll();
     
    1210        IEnumerable<HealthcareWorkers> GetAllByBranch(string Branch);
    1311        IEnumerable<HealthcareWorkers> GetAllByFacility(HealthFacilities Facility);
     12        void Add(HealthcareWorkers HealthcareWorker);
    1413    }
    1514}
  • FarmatikoServices/FarmatikoServices.csproj

    r4b342bb rd2e69be  
    66
    77  <ItemGroup>
     8    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
     9  </ItemGroup>
     10
     11  <ItemGroup>
    812    <ProjectReference Include="..\FarmatikoData\FarmatikoData.csproj" />
    913  </ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.