Changeset d2e69be for FarmatikoData
- Timestamp:
- 07/27/20 17:10:07 (4 years ago)
- Branches:
- master
- Children:
- ef1219a
- Parents:
- 4b342bb
- Location:
- FarmatikoData
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/Base/BaseEntity.cs
r4b342bb rd2e69be 9 9 public int Id { get; set; } 10 10 public DateTime CreatedOn { get; set; } 11 11 12 public DateTime DeletedOn { get; set; } 12 13 } -
FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs
r4b342bb rd2e69be 26 26 public IEnumerable<HealthFacilities> GetAll() 27 27 { 28 return _context.HealthFacilities ;28 return _context.HealthFacilities.OrderBy(x => x.Name).ToList(); 29 29 } 30 30 31 public HealthFacilities GetByFullName(string FullName)31 public IEnumerable<HealthFacilities> GetAllByName(string Name) 32 32 { 33 return (HealthFacilities)_context.HealthFacilities34 .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(); 36 36 } 37 37 38 public HealthFacilities GetByType(string FacilityType)38 IEnumerable<HealthFacilities> IHealthFacilityRepository.GetByType(string Type) 39 39 { 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)); 43 42 } 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 52 43 } 53 44 } -
FarmatikoData/FarmatikoRepoInterfaces/IHealthFacilityRepository.cs
r4b342bb rd2e69be 9 9 { 10 10 IEnumerable<HealthFacilities> GetAll(); 11 HealthFacilities GetByFullName(string FullName); 12 HealthFacilities GetByType(string FacilityType); 11 IEnumerable<HealthFacilities> GetByType(string Type); 13 12 void Add(HealthFacilities healthFacility); 14 void Remove(string healthFacility);13 IEnumerable<HealthFacilities> GetAllByName(string Name); 15 14 } 16 15 } -
FarmatikoData/Migrations/20200722131856_Initial migration.cs
r4b342bb rd2e69be 15 15 Id = table.Column<int>(nullable: false) 16 16 .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), 19 19 Name = table.Column<string>(nullable: false), 20 20 Municipality = table.Column<string>(nullable: false), … … 35 35 Id = table.Column<int>(nullable: false) 36 36 .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), 39 39 Name = table.Column<string>(nullable: true), 40 40 TotalMK = table.Column<int>(nullable: false), … … 57 57 Id = table.Column<int>(nullable: false) 58 58 .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), 61 61 Name = table.Column<string>(nullable: false), 62 62 Branch = table.Column<string>(nullable: false), … … 81 81 Id = table.Column<int>(nullable: false) 82 82 .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), 85 85 Name = table.Column<string>(nullable: true), 86 86 Strength = table.Column<string>(nullable: true), … … 103 103 Id = table.Column<int>(nullable: false) 104 104 .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), 107 107 PharmacyMedicinesId = table.Column<int>(nullable: true), 108 108 PharmacyId = table.Column<int>(nullable: true), … … 122 122 Id = table.Column<int>(nullable: false) 123 123 .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), 126 126 MedicinesId = table.Column<int>(nullable: true), 127 127 HasMedicine = table.Column<bool>(nullable: false), … … 151 151 Id = table.Column<int>(nullable: false) 152 152 .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), 155 155 Name = table.Column<string>(nullable: true), 156 156 Location = table.Column<string>(nullable: true),
Note:
See TracChangeset
for help on using the changeset viewer.