Index: Farmatiko/Controllers/AdminController.cs
===================================================================
--- Farmatiko/Controllers/AdminController.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ Farmatiko/Controllers/AdminController.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -44,11 +44,13 @@
         [HttpPost]
         [Route("api/pharmacyhead/add")]
-        public async Task<IActionResult> AddPharmacyHead([FromBody]PharmacyHead pharmacyHead)
+        public async Task<IActionResult> AddPharmacyHead([FromBody]PharmacyHeadDto pharmacyHead)
         {
-            await _service.AddPharmacyHead(pharmacyHead);
-            return Ok("Pharmacy added.");
+            bool Success = await _service.AddPharmacyHead(pharmacyHead);
+            if (Success)
+                return Ok("Pharmacy added.");
+            return BadRequest();
         }
 
-        [HttpDelete]
+        [HttpPost]
         [Route("api/pharmacyhead/delete/{Id}")] 
         public async Task<IActionResult> RemovePharmacyHead([FromRoute] int Id)
@@ -57,5 +59,5 @@
             return Ok();
         }
-        [HttpDelete]
+        [HttpPost]
         [Route("api/pharmacyhead/requests/{Id}")]
         public IActionResult RejectRequest([FromRoute] int Id)
Index: Farmatiko/Controllers/PharmacyHeadController.cs
===================================================================
--- Farmatiko/Controllers/PharmacyHeadController.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ Farmatiko/Controllers/PharmacyHeadController.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -44,5 +44,5 @@
             return Ok(Success);
         }
-        [HttpDelete]
+       /* [HttpDelete]
         [Route("api/pharmacyhead/delete/{Id}")]
         public async Task<IActionResult> Remove([FromRoute] int Id)
@@ -50,6 +50,6 @@
             bool Success = await _PHService.Remove(Id);
             return Ok(Success);
-        }
-        [HttpPost]
+        }*/
+       /* [HttpPost]
         [Route("api/pharmacyhead/requests/{Id}")]
         public async Task<IActionResult> RemoveClaimingRequest([FromRoute] int Id)
@@ -57,5 +57,5 @@
             bool Success = await _PHService.RemoveClaimingRequest(Id);
             return Ok(Success);
-        }
+        }*/
 
     }
Index: FarmatikoData/DTOs/PharmacyDTO.cs
===================================================================
--- FarmatikoData/DTOs/PharmacyDTO.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/DTOs/PharmacyDTO.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -11,9 +11,9 @@
         [JsonProperty("name")]
         public string Name { get; set; }
-        [JsonProperty("Location")]
+        [JsonProperty("location")]
         public string Location { get; set; }
         [JsonProperty("address")]
         public string Address { get; set; }
-        [JsonProperty("workalltime")]
+        [JsonProperty("workAllTime")]
         public bool WorkAllTime { get; set; }
         [JsonProperty("headName")]
Index: FarmatikoData/FarmatikoDataContext.cs
===================================================================
--- FarmatikoData/FarmatikoDataContext.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/FarmatikoDataContext.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -38,4 +38,8 @@
                 .ToTable("PHRequests");
 
+            modelBuilder.Entity<PharmacyHead>()
+                .Property(p => p.Id)
+                .ValueGeneratedOnAdd();
+
             /*modelBuilder.Entity<Medicine>()
                 .Property(x => x.Id)
@@ -74,5 +78,5 @@
                 .WithMany(p => p.Pharmacy);
             */
-            
+
             base.OnModelCreating(modelBuilder);
         }
Index: FarmatikoData/FarmatikoRepo/Repository.cs
===================================================================
--- FarmatikoData/FarmatikoRepo/Repository.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/FarmatikoRepo/Repository.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -71,5 +71,6 @@
                 Address = x.Address,
                 WorkAllTime = x.WorkAllTime,
-                PheadId = x.PheadId
+                PheadId = x.PheadId,
+                PharmacyHead = x.PharmacyHead
             }).Take(5).ToListAsync();
             return Pharmacies;
@@ -91,5 +92,5 @@
         {
             var SearchQuery = await _context.HealthFacilities
-            .Where(x => x.Name.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0)
+            .Where(x => x.Name.ToLowerInvariant().Contains(query.ToLowerInvariant()))
             .OrderBy(x => x.Name).ToListAsync();
 
@@ -100,5 +101,5 @@
         {
             var SearchQuery = await _context.Medicines
-            .Where(x => x.Name.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0)
+            .Where(x => x.Name.ToLowerInvariant().Contains(query.ToLowerInvariant()))
             .OrderBy(x => x.Name).ToListAsync();
 
@@ -109,5 +110,5 @@
         {
             var SearchQuery = await _context.Pharmacies
-            .Where(x => x.Name.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0)
+            .Where(x => x.Name.ToLowerInvariant().Contains(query.ToLowerInvariant()))
             .OrderBy(x => x.Name).ToListAsync();
 
@@ -118,5 +119,5 @@
         {
             var SearchQuery = await _context.HealthcareWorkers
-            .Where(x => x.Name.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0)
+            .Where(x => x.Name.ToLowerInvariant().Contains(query.ToLowerInvariant()))
             .OrderBy(x => x.Name).ToListAsync();
 
@@ -154,6 +155,11 @@
             if (pharmacyHead.Id == 0)
             {
-                var pheads = await _context.PharmacyHeads.ToListAsync();
-                if (!pheads.Select(x => x.Equals(pharmacyHead)).FirstOrDefault())
+                var pheads = await _context.PharmacyHeads.Select(x => new PharmacyHead 
+                {
+                    Name = x.Name,
+                    Email = x.Email
+                }).ToListAsync();
+                var pheadusr = pheads.Where(x => x.Email.Equals(pharmacyHead.Email)).ToList();
+                if (pheadusr == null || pheadusr.Count() == 0)
                 {
                     await _context.PharmacyHeads.AddAsync(pharmacyHead);
@@ -285,20 +291,40 @@
         }
 
-        public async Task AddUser(User user)
+        public async Task<bool> AddUser(User user)
         {
             if (user.Id == 0)
             {
-                var users = await _context.Users.ToListAsync();
-                if (!users.Select(x => x.Equals(user)).FirstOrDefault())
+                var users = await _context.Users.Select(x => new User
+                {
+                    Name = x.Name,
+                    Email = x.Email,
+                    Password = x.Password,
+                    UserRole = x.UserRole
+                }).ToListAsync();
+                var usr = users.Where(x => x.Email.Equals(user.Email)).ToList();
+                if (usr != null || usr.Count() > 0)
+                {
+                    return true;
+                }
+                else
                 {
                     await _context.Users.AddAsync(user);
                     await _context.SaveChangesAsync();
+                    return true;
                 }
             }
+            return false;
         }
 
         public async Task<List<PharmacyHeadMedicine>> GetAllPHMedicines()
         {
-            var list = await _context.PharmacyHeadMedicines.ToListAsync();
+            var list = await _context.PharmacyHeadMedicines.Select(x => new PharmacyHeadMedicine
+            {
+                PheadId = x.PheadId,
+                Head = x.Head,
+                MedicineId = x.MedicineId,
+                Medicine = x.Medicine
+            }
+            ).ToListAsync();
             return list;
         }
Index: FarmatikoData/FarmatikoRepoInterfaces/IRepository.cs
===================================================================
--- FarmatikoData/FarmatikoRepoInterfaces/IRepository.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/FarmatikoRepoInterfaces/IRepository.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -46,5 +46,5 @@
         User GetRole(string userName);
         ICollection<PharmacyHeadMedicine> GetPHMedicines(string email);
-        Task AddUser(User user);
+        Task<bool> AddUser(User user);
     }
 }
Index: rmatikoData/Migrations/20210124191844_InitialMigration.Designer.cs
===================================================================
--- FarmatikoData/Migrations/20210124191844_InitialMigration.Designer.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ 	(revision )
@@ -1,410 +1,0 @@
-﻿// <auto-generated />
-using System;
-using FarmatikoData;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace FarmatikoData.Migrations
-{
-    [DbContext(typeof(FarmatikoDataContext))]
-    [Migration("20210124191844_InitialMigration")]
-    partial class InitialMigration
-    {
-        protected override void BuildTargetModel(ModelBuilder modelBuilder)
-        {
-#pragma warning disable 612, 618
-            modelBuilder
-                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
-                .HasAnnotation("ProductVersion", "3.1.10")
-                .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
-            modelBuilder.Entity("FarmatikoData.Models.HealthFacility", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<string>("Address")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<string>("Email")
-                        .HasColumnType("text");
-
-                    b.Property<string>("Municipality")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Name")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Phone")
-                        .HasColumnType("text");
-
-                    b.Property<string>("Type")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("HealthFacilities");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.HealthcareWorker", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<string>("Branch")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<int>("FacilityId")
-                        .HasColumnType("integer");
-
-                    b.Property<string>("Name")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Title")
-                        .HasColumnType("text");
-
-                    b.HasKey("Id");
-
-                    b.HasIndex("FacilityId");
-
-                    b.ToTable("HealthcareWorkers");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.Medicine", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<string>("Form")
-                        .HasColumnType("text");
-
-                    b.Property<string>("Manufacturer")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Name")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Packaging")
-                        .HasColumnType("text");
-
-                    b.Property<float>("Price")
-                        .HasColumnType("real");
-
-                    b.Property<string>("Strength")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("WayOfIssuing")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Medicines");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.Pandemic", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<long>("ActiveGlobal")
-                        .HasColumnType("bigint");
-
-                    b.Property<int>("ActiveMK")
-                        .HasColumnType("integer");
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<long>("DeathsGlobal")
-                        .HasColumnType("bigint");
-
-                    b.Property<int>("DeathsMK")
-                        .HasColumnType("integer");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<string>("Name")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<int>("NewMK")
-                        .HasColumnType("integer");
-
-                    b.Property<long>("TotalGlobal")
-                        .HasColumnType("bigint");
-
-                    b.Property<int>("TotalMK")
-                        .HasColumnType("integer");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Pandemics");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.Pharmacy", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<string>("Address")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<string>("Location")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Name")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<int?>("PharmacyHeadId")
-                        .HasColumnType("integer");
-
-                    b.Property<int>("PheadId")
-                        .HasColumnType("integer");
-
-                    b.Property<bool>("WorkAllTime")
-                        .HasColumnType("boolean");
-
-                    b.HasKey("Id");
-
-                    b.HasIndex("PharmacyHeadId");
-
-                    b.ToTable("Pharmacies");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.PharmacyHead", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<string>("Email")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Name")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Password")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<int?>("UserId")
-                        .HasColumnType("integer");
-
-                    b.HasKey("Id");
-
-                    b.HasIndex("UserId");
-
-                    b.ToTable("PharmacyHeads");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.PharmacyHeadMedicine", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<int?>("HeadId")
-                        .HasColumnType("integer");
-
-                    b.Property<int>("MedicineId")
-                        .HasColumnType("integer");
-
-                    b.Property<int>("PheadId")
-                        .HasColumnType("integer");
-
-                    b.HasKey("Id");
-
-                    b.HasIndex("HeadId");
-
-                    b.HasIndex("MedicineId");
-
-                    b.ToTable("PharmacyHeadMedicines");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.RequestPharmacyHead", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<int>("HeadId")
-                        .HasColumnType("integer");
-
-                    b.Property<int>("PharmacyId")
-                        .HasColumnType("integer");
-
-                    b.HasKey("Id");
-
-                    b.HasIndex("HeadId");
-
-                    b.HasIndex("PharmacyId");
-
-                    b.ToTable("PHRequests");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.User", b =>
-                {
-                    b.Property<int>("Id")
-                        .ValueGeneratedOnAdd()
-                        .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
-
-                    b.Property<DateTime>("CreatedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<DateTime?>("DeletedOn")
-                        .HasColumnType("timestamp without time zone");
-
-                    b.Property<string>("Email")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Name")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<string>("Password")
-                        .IsRequired()
-                        .HasColumnType("text");
-
-                    b.Property<int>("UserRole")
-                        .HasColumnType("integer");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("Users");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.HealthcareWorker", b =>
-                {
-                    b.HasOne("FarmatikoData.Models.HealthFacility", "Facility")
-                        .WithMany()
-                        .HasForeignKey("FacilityId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.Pharmacy", b =>
-                {
-                    b.HasOne("FarmatikoData.Models.PharmacyHead", "PharmacyHead")
-                        .WithMany("Pharmacies")
-                        .HasForeignKey("PharmacyHeadId");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.PharmacyHead", b =>
-                {
-                    b.HasOne("FarmatikoData.Models.User", "User")
-                        .WithMany()
-                        .HasForeignKey("UserId");
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.PharmacyHeadMedicine", b =>
-                {
-                    b.HasOne("FarmatikoData.Models.PharmacyHead", "Head")
-                        .WithMany("Medicines")
-                        .HasForeignKey("HeadId");
-
-                    b.HasOne("FarmatikoData.Models.Medicine", "Medicine")
-                        .WithMany("Medicines")
-                        .HasForeignKey("MedicineId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("FarmatikoData.Models.RequestPharmacyHead", b =>
-                {
-                    b.HasOne("FarmatikoData.Models.PharmacyHead", "Head")
-                        .WithMany()
-                        .HasForeignKey("HeadId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("FarmatikoData.Models.Pharmacy", "Pharmacy")
-                        .WithMany()
-                        .HasForeignKey("PharmacyId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}
Index: rmatikoData/Migrations/20210124191844_InitialMigration.cs
===================================================================
--- FarmatikoData/Migrations/20210124191844_InitialMigration.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ 	(revision )
@@ -1,289 +1,0 @@
-﻿using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-namespace FarmatikoData.Migrations
-{
-    public partial class InitialMigration : Migration
-    {
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.CreateTable(
-                name: "HealthFacilities",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    Name = table.Column<string>(nullable: false),
-                    Municipality = table.Column<string>(nullable: false),
-                    Address = table.Column<string>(nullable: false),
-                    Type = table.Column<string>(nullable: false),
-                    Email = table.Column<string>(nullable: true),
-                    Phone = table.Column<string>(nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_HealthFacilities", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "Medicines",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    Name = table.Column<string>(nullable: false),
-                    Strength = table.Column<string>(nullable: false),
-                    Form = table.Column<string>(nullable: true),
-                    WayOfIssuing = table.Column<string>(nullable: false),
-                    Manufacturer = table.Column<string>(nullable: false),
-                    Price = table.Column<float>(nullable: false),
-                    Packaging = table.Column<string>(nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Medicines", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "Pandemics",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    Name = table.Column<string>(nullable: false),
-                    TotalMK = table.Column<int>(nullable: false),
-                    ActiveMK = table.Column<int>(nullable: false),
-                    DeathsMK = table.Column<int>(nullable: false),
-                    NewMK = table.Column<int>(nullable: false),
-                    TotalGlobal = table.Column<long>(nullable: false),
-                    DeathsGlobal = table.Column<long>(nullable: false),
-                    ActiveGlobal = table.Column<long>(nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Pandemics", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "Users",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    Name = table.Column<string>(nullable: false),
-                    Email = table.Column<string>(nullable: false),
-                    Password = table.Column<string>(nullable: false),
-                    UserRole = table.Column<int>(nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Users", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "HealthcareWorkers",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    Name = table.Column<string>(nullable: false),
-                    Branch = table.Column<string>(nullable: false),
-                    FacilityId = table.Column<int>(nullable: false),
-                    Title = table.Column<string>(nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_HealthcareWorkers", x => x.Id);
-                    table.ForeignKey(
-                        name: "FK_HealthcareWorkers_HealthFacilities_FacilityId",
-                        column: x => x.FacilityId,
-                        principalTable: "HealthFacilities",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "PharmacyHeads",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    Email = table.Column<string>(nullable: false),
-                    Name = table.Column<string>(nullable: false),
-                    Password = table.Column<string>(nullable: false),
-                    UserId = table.Column<int>(nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_PharmacyHeads", x => x.Id);
-                    table.ForeignKey(
-                        name: "FK_PharmacyHeads_Users_UserId",
-                        column: x => x.UserId,
-                        principalTable: "Users",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Restrict);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "Pharmacies",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    Name = table.Column<string>(nullable: false),
-                    Location = table.Column<string>(nullable: false),
-                    Address = table.Column<string>(nullable: false),
-                    WorkAllTime = table.Column<bool>(nullable: false),
-                    PheadId = table.Column<int>(nullable: false),
-                    PharmacyHeadId = table.Column<int>(nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Pharmacies", x => x.Id);
-                    table.ForeignKey(
-                        name: "FK_Pharmacies_PharmacyHeads_PharmacyHeadId",
-                        column: x => x.PharmacyHeadId,
-                        principalTable: "PharmacyHeads",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Restrict);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "PharmacyHeadMedicines",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    PheadId = table.Column<int>(nullable: true),
-                    HeadId = table.Column<int>(nullable: true),
-                    MedicineId = table.Column<int>(nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_PharmacyHeadMedicines", x => x.Id);
-                    table.ForeignKey(
-                        name: "FK_PharmacyHeadMedicines_PharmacyHeads_HeadId",
-                        column: x => x.HeadId,
-                        principalTable: "PharmacyHeads",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Restrict);
-                    table.ForeignKey(
-                        name: "FK_PharmacyHeadMedicines_Medicines_MedicineId",
-                        column: x => x.MedicineId,
-                        principalTable: "Medicines",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "PHRequests",
-                columns: table => new
-                {
-                    Id = table.Column<int>(nullable: false)
-                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
-                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
-                    DeletedOn = table.Column<DateTime>(nullable: true),
-                    HeadId = table.Column<int>(nullable: false),
-                    PharmacyId = table.Column<int>(nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_PHRequests", x => x.Id);
-                    table.ForeignKey(
-                        name: "FK_PHRequests_PharmacyHeads_HeadId",
-                        column: x => x.HeadId,
-                        principalTable: "PharmacyHeads",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                    table.ForeignKey(
-                        name: "FK_PHRequests_Pharmacies_PharmacyId",
-                        column: x => x.PharmacyId,
-                        principalTable: "Pharmacies",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                });
-
-            migrationBuilder.CreateIndex(
-                name: "IX_HealthcareWorkers_FacilityId",
-                table: "HealthcareWorkers",
-                column: "FacilityId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_Pharmacies_PharmacyHeadId",
-                table: "Pharmacies",
-                column: "PharmacyHeadId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_PharmacyHeadMedicines_HeadId",
-                table: "PharmacyHeadMedicines",
-                column: "HeadId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_PharmacyHeadMedicines_MedicineId",
-                table: "PharmacyHeadMedicines",
-                column: "MedicineId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_PharmacyHeads_UserId",
-                table: "PharmacyHeads",
-                column: "UserId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_PHRequests_HeadId",
-                table: "PHRequests",
-                column: "HeadId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_PHRequests_PharmacyId",
-                table: "PHRequests",
-                column: "PharmacyId");
-        }
-
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DropTable(
-                name: "HealthcareWorkers");
-
-            migrationBuilder.DropTable(
-                name: "Pandemics");
-
-            migrationBuilder.DropTable(
-                name: "PharmacyHeadMedicines");
-
-            migrationBuilder.DropTable(
-                name: "PHRequests");
-
-            migrationBuilder.DropTable(
-                name: "HealthFacilities");
-
-            migrationBuilder.DropTable(
-                name: "Medicines");
-
-            migrationBuilder.DropTable(
-                name: "Pharmacies");
-
-            migrationBuilder.DropTable(
-                name: "PharmacyHeads");
-
-            migrationBuilder.DropTable(
-                name: "Users");
-        }
-    }
-}
Index: FarmatikoData/Migrations/20210205174704_Initial-Migration.Designer.cs
===================================================================
--- FarmatikoData/Migrations/20210205174704_Initial-Migration.Designer.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
+++ FarmatikoData/Migrations/20210205174704_Initial-Migration.Designer.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -0,0 +1,407 @@
+﻿// <auto-generated />
+using System;
+using FarmatikoData;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+namespace FarmatikoData.Migrations
+{
+    [DbContext(typeof(FarmatikoDataContext))]
+    [Migration("20210205174704_Initial-Migration")]
+    partial class InitialMigration
+    {
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
+                .HasAnnotation("ProductVersion", "3.1.10")
+                .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+            modelBuilder.Entity("FarmatikoData.Models.HealthFacility", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<string>("Address")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<string>("Email")
+                        .HasColumnType("text");
+
+                    b.Property<string>("Municipality")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Phone")
+                        .HasColumnType("text");
+
+                    b.Property<string>("Type")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("HealthFacilities");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.HealthcareWorker", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<string>("Branch")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<int>("FacilityId")
+                        .HasColumnType("integer");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Title")
+                        .HasColumnType("text");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("FacilityId");
+
+                    b.ToTable("HealthcareWorkers");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.Medicine", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<string>("Form")
+                        .HasColumnType("text");
+
+                    b.Property<string>("Manufacturer")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Packaging")
+                        .HasColumnType("text");
+
+                    b.Property<float>("Price")
+                        .HasColumnType("real");
+
+                    b.Property<string>("Strength")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("WayOfIssuing")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Medicines");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.Pandemic", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<long>("ActiveGlobal")
+                        .HasColumnType("bigint");
+
+                    b.Property<int>("ActiveMK")
+                        .HasColumnType("integer");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<long>("DeathsGlobal")
+                        .HasColumnType("bigint");
+
+                    b.Property<int>("DeathsMK")
+                        .HasColumnType("integer");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<int>("NewMK")
+                        .HasColumnType("integer");
+
+                    b.Property<long>("TotalGlobal")
+                        .HasColumnType("bigint");
+
+                    b.Property<int>("TotalMK")
+                        .HasColumnType("integer");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Pandemics");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.Pharmacy", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<string>("Address")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<string>("Location")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<int?>("PharmacyHeadId")
+                        .HasColumnType("integer");
+
+                    b.Property<int>("PheadId")
+                        .HasColumnType("integer");
+
+                    b.Property<bool>("WorkAllTime")
+                        .HasColumnType("boolean");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PharmacyHeadId");
+
+                    b.ToTable("Pharmacies");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.PharmacyHead", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<string>("Email")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Password")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<int>("UserID")
+                        .HasColumnType("integer");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserID");
+
+                    b.ToTable("PharmacyHeads");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.PharmacyHeadMedicine", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<int?>("HeadId")
+                        .HasColumnType("integer");
+
+                    b.Property<int>("MedicineId")
+                        .HasColumnType("integer");
+
+                    b.Property<int>("PheadId")
+                        .HasColumnType("integer");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("HeadId");
+
+                    b.HasIndex("MedicineId");
+
+                    b.ToTable("PharmacyHeadMedicines");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.RequestPharmacyHead", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<int>("HeadId")
+                        .HasColumnType("integer");
+
+                    b.Property<int>("PharmacyId")
+                        .HasColumnType("integer");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("HeadId");
+
+                    b.HasIndex("PharmacyId");
+
+                    b.ToTable("PHRequests");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.User", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<DateTime?>("DeletedOn")
+                        .HasColumnType("timestamp without time zone");
+
+                    b.Property<string>("Email")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<string>("Password")
+                        .IsRequired()
+                        .HasColumnType("text");
+
+                    b.Property<int>("UserRole")
+                        .HasColumnType("integer");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Users");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.HealthcareWorker", b =>
+                {
+                    b.HasOne("FarmatikoData.Models.HealthFacility", "Facility")
+                        .WithMany()
+                        .HasForeignKey("FacilityId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.Pharmacy", b =>
+                {
+                    b.HasOne("FarmatikoData.Models.PharmacyHead", "PharmacyHead")
+                        .WithMany("Pharmacies")
+                        .HasForeignKey("PharmacyHeadId");
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.PharmacyHead", b =>
+                {
+                    b.HasOne("FarmatikoData.Models.User", "User")
+                        .WithMany()
+                        .HasForeignKey("UserID")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.PharmacyHeadMedicine", b =>
+                {
+                    b.HasOne("FarmatikoData.Models.PharmacyHead", "Head")
+                        .WithMany("Medicines")
+                        .HasForeignKey("HeadId");
+
+                    b.HasOne("FarmatikoData.Models.Medicine", "Medicine")
+                        .WithMany("Medicines")
+                        .HasForeignKey("MedicineId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("FarmatikoData.Models.RequestPharmacyHead", b =>
+                {
+                    b.HasOne("FarmatikoData.Models.PharmacyHead", "Head")
+                        .WithMany()
+                        .HasForeignKey("HeadId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("FarmatikoData.Models.Pharmacy", "Pharmacy")
+                        .WithMany()
+                        .HasForeignKey("PharmacyId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}
Index: FarmatikoData/Migrations/20210205174704_Initial-Migration.cs
===================================================================
--- FarmatikoData/Migrations/20210205174704_Initial-Migration.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
+++ FarmatikoData/Migrations/20210205174704_Initial-Migration.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -0,0 +1,289 @@
+﻿using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+namespace FarmatikoData.Migrations
+{
+    public partial class InitialMigration : Migration
+    {
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "HealthFacilities",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql:"now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    Name = table.Column<string>(nullable: false),
+                    Municipality = table.Column<string>(nullable: false),
+                    Address = table.Column<string>(nullable: false),
+                    Type = table.Column<string>(nullable: false),
+                    Email = table.Column<string>(nullable: true),
+                    Phone = table.Column<string>(nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_HealthFacilities", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Medicines",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    Name = table.Column<string>(nullable: false),
+                    Strength = table.Column<string>(nullable: false),
+                    Form = table.Column<string>(nullable: true),
+                    WayOfIssuing = table.Column<string>(nullable: false),
+                    Manufacturer = table.Column<string>(nullable: false),
+                    Price = table.Column<float>(nullable: false),
+                    Packaging = table.Column<string>(nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Medicines", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Pandemics",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    Name = table.Column<string>(nullable: false),
+                    TotalMK = table.Column<int>(nullable: false),
+                    ActiveMK = table.Column<int>(nullable: false),
+                    DeathsMK = table.Column<int>(nullable: false),
+                    NewMK = table.Column<int>(nullable: false),
+                    TotalGlobal = table.Column<long>(nullable: false),
+                    DeathsGlobal = table.Column<long>(nullable: false),
+                    ActiveGlobal = table.Column<long>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Pandemics", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Users",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    Name = table.Column<string>(nullable: false),
+                    Email = table.Column<string>(nullable: false),
+                    Password = table.Column<string>(nullable: false),
+                    UserRole = table.Column<int>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Users", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "HealthcareWorkers",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    Name = table.Column<string>(nullable: false),
+                    Branch = table.Column<string>(nullable: false),
+                    FacilityId = table.Column<int>(nullable: false),
+                    Title = table.Column<string>(nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_HealthcareWorkers", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_HealthcareWorkers_HealthFacilities_FacilityId",
+                        column: x => x.FacilityId,
+                        principalTable: "HealthFacilities",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "PharmacyHeads",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    Email = table.Column<string>(nullable: false),
+                    Name = table.Column<string>(nullable: false),
+                    Password = table.Column<string>(nullable: false),
+                    UserID = table.Column<int>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_PharmacyHeads", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_PharmacyHeads_Users_UserID",
+                        column: x => x.UserID,
+                        principalTable: "Users",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Pharmacies",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    Name = table.Column<string>(nullable: false),
+                    Location = table.Column<string>(nullable: false),
+                    Address = table.Column<string>(nullable: false),
+                    WorkAllTime = table.Column<bool>(nullable: false),
+                    PheadId = table.Column<int>(nullable: false),
+                    PharmacyHeadId = table.Column<int>(nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Pharmacies", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_Pharmacies_PharmacyHeads_PharmacyHeadId",
+                        column: x => x.PharmacyHeadId,
+                        principalTable: "PharmacyHeads",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Restrict);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "PharmacyHeadMedicines",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    PheadId = table.Column<int>(nullable: false),
+                    HeadId = table.Column<int>(nullable: true),
+                    MedicineId = table.Column<int>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_PharmacyHeadMedicines", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_PharmacyHeadMedicines_PharmacyHeads_HeadId",
+                        column: x => x.HeadId,
+                        principalTable: "PharmacyHeads",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Restrict);
+                    table.ForeignKey(
+                        name: "FK_PharmacyHeadMedicines_Medicines_MedicineId",
+                        column: x => x.MedicineId,
+                        principalTable: "Medicines",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "PHRequests",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
+                    CreatedOn = table.Column<DateTime>(nullable: false, defaultValueSql: "now()"),
+                    DeletedOn = table.Column<DateTime>(nullable: true),
+                    HeadId = table.Column<int>(nullable: false),
+                    PharmacyId = table.Column<int>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_PHRequests", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_PHRequests_PharmacyHeads_HeadId",
+                        column: x => x.HeadId,
+                        principalTable: "PharmacyHeads",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                    table.ForeignKey(
+                        name: "FK_PHRequests_Pharmacies_PharmacyId",
+                        column: x => x.PharmacyId,
+                        principalTable: "Pharmacies",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateIndex(
+                name: "IX_HealthcareWorkers_FacilityId",
+                table: "HealthcareWorkers",
+                column: "FacilityId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_Pharmacies_PharmacyHeadId",
+                table: "Pharmacies",
+                column: "PharmacyHeadId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_PharmacyHeadMedicines_HeadId",
+                table: "PharmacyHeadMedicines",
+                column: "HeadId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_PharmacyHeadMedicines_MedicineId",
+                table: "PharmacyHeadMedicines",
+                column: "MedicineId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_PharmacyHeads_UserID",
+                table: "PharmacyHeads",
+                column: "UserID");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_PHRequests_HeadId",
+                table: "PHRequests",
+                column: "HeadId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_PHRequests_PharmacyId",
+                table: "PHRequests",
+                column: "PharmacyId");
+        }
+
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "HealthcareWorkers");
+
+            migrationBuilder.DropTable(
+                name: "Pandemics");
+
+            migrationBuilder.DropTable(
+                name: "PharmacyHeadMedicines");
+
+            migrationBuilder.DropTable(
+                name: "PHRequests");
+
+            migrationBuilder.DropTable(
+                name: "HealthFacilities");
+
+            migrationBuilder.DropTable(
+                name: "Medicines");
+
+            migrationBuilder.DropTable(
+                name: "Pharmacies");
+
+            migrationBuilder.DropTable(
+                name: "PharmacyHeads");
+
+            migrationBuilder.DropTable(
+                name: "Users");
+        }
+    }
+}
Index: FarmatikoData/Migrations/FarmatikoDataContextModelSnapshot.cs
===================================================================
--- FarmatikoData/Migrations/FarmatikoDataContextModelSnapshot.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/Migrations/FarmatikoDataContextModelSnapshot.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -99,5 +99,4 @@
                         .ValueGeneratedOnAdd()
                         .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
 
@@ -186,5 +185,4 @@
                         .ValueGeneratedOnAdd()
                         .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
 
@@ -228,5 +226,4 @@
                         .ValueGeneratedOnAdd()
                         .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
 
@@ -249,10 +246,10 @@
                         .HasColumnType("text");
 
-                    b.Property<int?>("UserId")
-                        .HasColumnType("integer");
-
-                    b.HasKey("Id");
-
-                    b.HasIndex("UserId");
+                    b.Property<int>("UserID")
+                        .HasColumnType("integer");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserID");
 
                     b.ToTable("PharmacyHeads");
@@ -264,5 +261,4 @@
                         .ValueGeneratedOnAdd()
                         .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
 
@@ -296,5 +292,4 @@
                         .ValueGeneratedOnAdd()
                         .HasColumnType("integer")
-                        .HasAnnotation("Npgsql:IdentitySequenceOptions", "'1', '1', '', '', 'False', '1'")
                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
 
@@ -373,5 +368,7 @@
                     b.HasOne("FarmatikoData.Models.User", "User")
                         .WithMany()
-                        .HasForeignKey("UserId");
+                        .HasForeignKey("UserID")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
Index: FarmatikoData/Models/Medicine.cs
===================================================================
--- FarmatikoData/Models/Medicine.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/Models/Medicine.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -23,5 +23,5 @@
         public string Packaging { get; set; }
         //[JsonPropertyName("PHMedicineList")]
-        public ICollection<PharmacyHeadMedicine> Medicines { get; set; }
+        public virtual ICollection<PharmacyHeadMedicine> Medicines { get; set; }
         public Medicine(string Name, string Strength, string Form, string WayOfIssuing, string Manufacturer, float Price, string Packaging)
         {
Index: FarmatikoData/Models/Pharmacy.cs
===================================================================
--- FarmatikoData/Models/Pharmacy.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/Models/Pharmacy.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -5,4 +5,5 @@
 using FarmatikoData.Base;
 using Microsoft.EntityFrameworkCore;
+using Newtonsoft.Json;
 
 namespace FarmatikoData.Models
@@ -12,10 +13,14 @@
         public Pharmacy() { }
         [Required]
+        [JsonProperty("name")]
         public string Name { get; set; }
         [Required]
+        [JsonProperty("location")]
         public string Location { get; set; }
         [Required]
+        [JsonProperty("address")]
         public string Address { get; set; }
         [Required]
+        [JsonProperty("workAllTime")]
         public bool WorkAllTime { get; set; }
         public Pharmacy(string Name, string Location, string Address, bool WorkAllTime)
Index: FarmatikoData/Models/PharmacyHead.cs
===================================================================
--- FarmatikoData/Models/PharmacyHead.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoData/Models/PharmacyHead.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -24,5 +24,6 @@
         public virtual List<Pharmacy> Pharmacies { get; set; }
         public virtual List<PharmacyHeadMedicine> Medicines { get; set; }
-        
+
+        public int UserID { get; set; }
         public User User { get; set; }
 
Index: FarmatikoServices/FarmatikoServiceInterfaces/IService.cs
===================================================================
--- FarmatikoServices/FarmatikoServiceInterfaces/IService.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoServices/FarmatikoServiceInterfaces/IService.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -28,5 +28,5 @@
         Task AddFacility(HealthFacility healthFacilities);
         Task AddPharmacy(Pharmacy pharmacy);
-        Task AddPharmacyHead(PharmacyHead pharmacyHead);
+        Task<bool> AddPharmacyHead(PharmacyHeadDto pharmacyHead);
         Task AddMedicines(Medicine medicine);
         Task AddPandemic(Pandemic pandemic);
Index: FarmatikoServices/Services/PHService.cs
===================================================================
--- FarmatikoServices/Services/PHService.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoServices/Services/PHService.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -73,38 +73,44 @@
 
                 
-
-                if (!pharmacyHead.Medicines.Equals(PHMedicines))
-                {
-                    //phead.Medicines = pharmacyHead.Medicines;
-                    if (pharmacyHead.Medicines.Count() == 0)
+                if (pharmacyHead.Medicines != null || pharmacyHead.Medicines.Count() > 0)
+                    if (!pharmacyHead.Medicines.Equals(PHMedicines))
                     {
-                        phead.Medicines = null;
-                        int PHMId = phead.Medicines.Select(x => x.Id).Single();
-                        int phId = phead.Medicines.Select(x => x.PheadId).Single();
-                        int medId = phead.Medicines.Select(x => x.MedicineId).Single();
-                        _iPHRepo.DeletePHMedicine(PHMId, phId, medId);
-                        return;
+                        //phead.Medicines = pharmacyHead.Medicines;
+                        if (pharmacyHead.Medicines.Count() == 0)
+                        {
+                            phead.Medicines = null;
+                            int PHMId = phead.Medicines.Select(x => x.Id).Single();
+                            int phId = phead.Medicines.Select(x => x.PheadId).Single();
+                            int medId = phead.Medicines.Select(x => x.MedicineId).Single();
+                            _iPHRepo.DeletePHMedicine(PHMId, phId, medId);
+                            return;
+                        }
+                        foreach (var med in pharmacyHead.Medicines)
+                        {
+
+                            PharmacyHeadMedicine PHMObj = phead.Medicines.Select(x => new PharmacyHeadMedicine
+                            {
+                                Id = x.Id,
+                                PheadId = x.PheadId,
+                                Head = x.Head,
+                                MedicineId = x.MedicineId,
+                                Medicine = x.Medicine
+                            }).Where(x => !x.Medicine.Equals(med)).Single();
+                            if (PHMObj == null || PHMObj == default)
+                                break;
+                            if (PHMObj.MedicineId == med.Id)
+                                list.Add(PHMObj);
+
+                        }
+
+                        phead.Medicines = list;
+
+                        await _iPHRepo.UpdatePharmacyHead(phead);
+
                     }
-                    foreach (var med in pharmacyHead.Medicines)
-                    {
-
-                        PharmacyHeadMedicine PHMObj = phead.Medicines.Select(x => new PharmacyHeadMedicine
-                        {
-                            Id = x.Id,
-                            PheadId = x.PheadId,
-                            Head = x.Head,
-                            MedicineId = x.MedicineId,
-                            Medicine = x.Medicine
-                        }).Where(x => !x.Medicine.Equals(med)).Single();
-                        if (PHMObj == null || PHMObj == default)
-                            break;
-                        if (PHMObj.MedicineId == med.Id)
-                            list.Add(PHMObj);
-
-                    }
-
-                    phead.Medicines = list;
-
-                    await _iPHRepo.UpdatePharmacyHead(phead);
+                
+                if (pharmacyHead.Pharmacies != null || pharmacyHead.Pharmacies.Count() > 0)
+                {
+                    phead.Pharmacies = pharmacyHead.Pharmacies;
                 }
                 PharmacyHead head = new PharmacyHead()
@@ -112,7 +118,5 @@
                     Name = pharmacyHead.Name,
                     Email = pharmacyHead.Email,
-                    Password = pharmacyHead.Password,
-                    Pharmacies = pharmacyHead.Pharmacies,
-                    Medicines = list
+                    Password = pharmacyHead.Password
                 };
                 if (!phead.Equals(head))
Index: FarmatikoServices/Services/Service.cs
===================================================================
--- FarmatikoServices/Services/Service.cs	(revision ac5132621e96b58639b50b72d50dec9d0894784a)
+++ FarmatikoServices/Services/Service.cs	(revision 0a694bb724ad18bed38e0531e7ebb8039040e1ab)
@@ -48,8 +48,13 @@
             List<MedicineDTO> list = new List<MedicineDTO>();
             var listPHMedicines = await _repository.GetAllPHMedicines();
-            foreach(var med in Medicines)
-            {
-                var heads = listPHMedicines.Where(x => x.MedicineId == med.Id).Select(x => x.Head).ToList();
-                List<string> headNames = new List<string>();
+            List<string> headNames = new List<string>();
+            List<PharmacyHead> heads = new List<PharmacyHead>();
+            foreach (var med in Medicines)
+            {
+                var meds = listPHMedicines.Where(x => x.MedicineId == med.Id).ToList();
+                if (meds != null)
+                {
+                    heads = meds.Select(x => x.Head).ToList();
+                }
                 headNames = heads.Select(x => x.Name).ToList();
                 MedicineDTO medicine = new MedicineDTO()
@@ -89,7 +94,11 @@
                     Location = pharm.Location,
                     Address = pharm.Address,
-                    WorkAllTime = pharm.WorkAllTime,
-                    HeadName = pharm.PharmacyHead.Name?? "" 
+                    WorkAllTime = pharm.WorkAllTime
                 };
+                if (pharm.PharmacyHead != null)
+                {
+                    pharmacyDTO.HeadName = pharm.PharmacyHead.Name;
+                }
+
                 pharmacies.Add(pharmacyDTO);
             }
@@ -165,8 +174,6 @@
 
         // Ovaa kontrola ja ima samo admin
-        public User MakeUser(PharmacyHead head)
-        {
-            
-            
+        public async Task<User> MakeUser(PharmacyHead head)
+        {
             User user = new User()
             {
@@ -176,15 +183,38 @@
                 UserRole = User.Role.PharmacyHead
             };
+            bool Success = await _repository.AddUser(user);
+            if (!Success)
+                return null;
             return user;
         }
-        public async Task AddPharmacyHead(PharmacyHead pharmacyHead)
+        public async Task<bool> AddPharmacyHead(PharmacyHeadDto pharmacyHead)
         {
             if (pharmacyHead != null)
             {
-                var user = MakeUser(pharmacyHead);
-                await _repository.AddUser(user);                
-                await _repository.AddPharmacyHead(pharmacyHead);
+                var phead = new PharmacyHead()
+                {
+                    Name = pharmacyHead.Name,
+                    Email = pharmacyHead.Email,
+                    Password = pharmacyHead.Password
+                };
+                var user = await MakeUser(phead);
+                if (user is null)
+                {
+                    return false;
+                }
+                var users = _repository.GetUsers();
+                var thisUser = users.Where(usr => usr.Value.Email.Equals(user.Email)).Select(x => x.Value).FirstOrDefault();
+                User user1 = new User()
+                {
+                    Name = thisUser.Name,
+                    Password = thisUser.Password,
+                    Email = thisUser.Email,
+                    UserRole = thisUser.UserRole
+                };
+                phead.User = user1;
+                await _repository.AddPharmacyHead(phead);
+                return true;
             }
-            else throw new Exception("PharmacyHead is null");
+            else throw new Exception("PharmacyHeadDto is null");
         }
         //za json(Sys updater)
