Changeset d2e69be for FarmatikoData


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

Add Route Attribute

Location:
FarmatikoData
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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),
Note: See TracChangeset for help on using the changeset viewer.