Index: PostgreSqlDotnetCore/Controllers/BlogController.cs
===================================================================
--- PostgreSqlDotnetCore/Controllers/BlogController.cs	(revision d6040ef6cd58a54b3bdd9c77a26c8a6ed428662e)
+++ PostgreSqlDotnetCore/Controllers/BlogController.cs	(revision 57fc40271dfe03c973365d9799d1dbf2d4360b8f)
@@ -79,8 +79,18 @@
         //}
 
-        public ActionResult Create()
-        {
-            var model = new BlogPostConsultation();
-            return View(model);
+        /* public ActionResult Create()
+         {
+             var model = new BlogPostConsultation();
+             return View(model);
+         }*/
+
+        public async Task<ActionResult> CreateAsync()
+        {
+
+            // check for permission
+            UsersClass customerClass = await getCrrentUser();
+            // set if is authenticated
+            ViewBag.isAuthenticated = customerClass;
+            return View();
         }
 
@@ -90,26 +100,38 @@
         [HttpPost]
         [ValidateAntiForgeryToken]
-        public async Task<ActionResult> CreateAsync([Bind(include: "id,date_askes,title,description,users_id")] BlogPostConsultation blogClass)
-        {
-            if (ModelState.IsValid)
-            {
-                bool isAuthenticated = User.Identity.IsAuthenticated;
-                if (isAuthenticated)
-                {
-                    var user = await _userManager.GetUserAsync(User);
-                    var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
-                    blogClass.users_id = customerClass.id;
-                    db.BlogPostControllerObj.Add(blogClass);
-                    db.SaveChanges();
-                return RedirectToAction("Index");
-                }
-                else
-                {
-                    return RedirectToAction("AccessDenied", "Error");
-                }
-            }
-
-            return View(blogClass);
-        }
+         public async Task<ActionResult> CreateAsync([Bind(include: "id,date_askes,title,description,users_id")] BlogPostConsultation blogClass)
+         {
+             if (ModelState.IsValid)
+             {
+                 bool isAuthenticated = User.Identity.IsAuthenticated;
+                 if (isAuthenticated)
+                 {
+                     var user = await _userManager.GetUserAsync(User);
+                     var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
+                     if (customerClass != null)
+                     {
+                         // Поставете users_id на идентификаторот на корисникот
+                         blogClass.users_id = customerClass.id;
+                        //blogClass.date_askes = DateOnly.FromDateTime(DateTime.UtcNow); 
+                        blogClass.date_askes = DateOnly.FromDateTime(DateTime.Now); // Ова ќе стави локално време
+
+                        db.BlogPostControllerObj.Add(blogClass);
+                         await db.SaveChangesAsync();
+                         return RedirectToAction("Index");
+                     }
+                 }
+                 else
+                 {
+                     return RedirectToAction("AccessDenied", "Error");
+                 }
+             }
+
+             return View(blogClass);
+         }
+
+       
+       
+
+
 
         // GET: Customer/Edit/5
Index: PostgreSqlDotnetCore/Controllers/CityController.cs
===================================================================
--- PostgreSqlDotnetCore/Controllers/CityController.cs	(revision d6040ef6cd58a54b3bdd9c77a26c8a6ed428662e)
+++ PostgreSqlDotnetCore/Controllers/CityController.cs	(revision 57fc40271dfe03c973365d9799d1dbf2d4360b8f)
@@ -17,4 +17,23 @@
         public async Task<ActionResult> IndexAsync()
          {
+           // check for permission
+          UsersClass customerClass = await checkAuthorizationAsync();
+
+
+           if (customerClass == null)
+             {
+                 return RedirectToAction("AccessDenied", "Error");
+             }
+
+            var citiess = await db.CitiesObj.ToListAsync();
+
+            return View(citiess);
+        }
+       
+
+
+
+        /* public async Task<ActionResult> IndexAsync()
+         {
              // check for permission
              UsersClass customerClass = await checkAuthorizationAsync();
@@ -26,5 +45,6 @@
              return View(db.CitiesObj.ToList());
          }
-       
+        */
+
 
 
@@ -138,4 +158,8 @@
             base.Dispose(disposing);
         }
+
+
+
+        
     }
 }
Index: PostgreSqlDotnetCore/Controllers/PetCaresController.cs
===================================================================
--- PostgreSqlDotnetCore/Controllers/PetCaresController.cs	(revision d6040ef6cd58a54b3bdd9c77a26c8a6ed428662e)
+++ PostgreSqlDotnetCore/Controllers/PetCaresController.cs	(revision 57fc40271dfe03c973365d9799d1dbf2d4360b8f)
@@ -78,5 +78,5 @@
 
         // GET: Customer/Details/5
-        public ActionResult Details(int? id)
+        public async Task<ActionResult> Details(int? id)
         {
             if (id == null)
@@ -84,4 +84,6 @@
                 return RedirectToAction("NotExist", "Error");
             }
+            UsersClass customerClass = await getCrrentUser(); 
+            ViewBag.isAuthenticated = customerClass;
             Pet_CaresClass peClass = db.PetCaresObj.Find(id);
             if (peClass == null)
@@ -178,5 +180,6 @@
             var vetCenters = await db.VetCentersObj.ToListAsync();
             ViewBag.VetCenters = new SelectList(vetCenters, "id", "name", peClass.vetcentersid);
-
+            // dodadeno na 22.08
+            ViewBag.isAuthenticated = await getCrrentUser();
             return View(peClass);
         }
@@ -196,4 +199,5 @@
                 return RedirectToAction("AccessDenied", "Error");
             }
+            ViewBag.isAuthenticated = await getCrrentUser();
 
             if (ModelState.IsValid)
@@ -214,5 +218,5 @@
 
         // GET: Customer/Delete/5
-        public ActionResult Delete(int? id)
+        public async Task<ActionResult> Delete(int? id)
         {
             if (id == null)
@@ -220,4 +224,6 @@
                 return RedirectToAction("NotExist", "Error");
             }
+            UsersClass customerClass = await getCrrentUser(); // Добијте ја тековната улога на корисникот
+            ViewBag.isAuthenticated = customerClass;
             Pet_CaresClass peClass = db.PetCaresObj.Find(id);
             if (peClass == null)
Index: PostgreSqlDotnetCore/Controllers/PetsController.cs
===================================================================
--- PostgreSqlDotnetCore/Controllers/PetsController.cs	(revision d6040ef6cd58a54b3bdd9c77a26c8a6ed428662e)
+++ PostgreSqlDotnetCore/Controllers/PetsController.cs	(revision 57fc40271dfe03c973365d9799d1dbf2d4360b8f)
@@ -45,5 +45,19 @@
 
         // GET: Customer/Details/5
-        public ActionResult Details(int? id)
+        /* public ActionResult Details(int? id)
+         {
+             if (id == null)
+             {
+                 return RedirectToAction("NotExist", "Error");
+             }
+             PetsClass peClass = db.PetsObj.Find(id);
+             if (peClass == null)
+             {
+                 return RedirectToAction("NotExist", "Error");
+             }
+             return View(peClass);
+         }*/
+
+        public async Task<ActionResult> Details(int? id)
         {
             if (id == null)
@@ -51,9 +65,14 @@
                 return RedirectToAction("NotExist", "Error");
             }
-            PetsClass peClass = db.PetsObj.Find(id);
+
+            UsersClass customerClass = await getCrrentUser(); // Добијте ја тековната улога на корисникот
+            ViewBag.isAuthenticated = customerClass;
+
+            PetsClass peClass = await db.PetsObj.FindAsync(id);
             if (peClass == null)
             {
                 return RedirectToAction("NotExist", "Error");
             }
+
             return View(peClass);
         }
@@ -110,5 +129,6 @@
 
         // GET: Customer/Edit/5
-        public ActionResult Edit(int? id)
+        // public ActionResult Edit(int? id)
+        public async Task<ActionResult> Edit(int? id)
         {
             if (id == null)
@@ -121,4 +141,6 @@
                 return RedirectToAction("NotExist", "Error");
             }
+            // додадено на 21.08
+            ViewBag.isAuthenticated = await getCrrentUser();
             return View(peClass);
         }
@@ -132,4 +154,6 @@
         {
             bool isAuthenticated = User.Identity.IsAuthenticated;
+            ViewBag.isAuthenticated = await getCrrentUser();
+
             if (!isAuthenticated)
             {
@@ -140,5 +164,7 @@
 
             // set if is authenticated
-            ViewBag.isAuthenticated = new UsersClass();
+            // додадено и избришено
+            ViewBag.isAuthenticated = await getCrrentUser();
+            //ViewBag.isAuthenticated = new UsersClass();
             
              
@@ -158,5 +184,19 @@
 
         // GET: Customer/Delete/5
-        public ActionResult Delete(int? id)
+        /* public ActionResult Delete(int? id)
+         {
+             if (id == null)
+             {
+                 return RedirectToAction("NotExist", "Error");
+             }
+             PetsClass peClass = db.PetsObj.Find(id);
+             if (peClass == null)
+             {
+                 return RedirectToAction("NotExist", "Error");
+             }
+             return View(peClass);
+         }*/
+
+        public async Task<ActionResult> Delete(int? id)
         {
             if (id == null)
@@ -164,9 +204,14 @@
                 return RedirectToAction("NotExist", "Error");
             }
-            PetsClass peClass = db.PetsObj.Find(id);
+
+            UsersClass customerClass = await getCrrentUser(); // Добијте ја тековната улога на корисникот
+            ViewBag.isAuthenticated = customerClass;
+
+            PetsClass peClass = await db.PetsObj.FindAsync(id);
             if (peClass == null)
             {
                 return RedirectToAction("NotExist", "Error");
             }
+
             return View(peClass);
         }
Index: PostgreSqlDotnetCore/Controllers/ProductsController.cs
===================================================================
--- PostgreSqlDotnetCore/Controllers/ProductsController.cs	(revision d6040ef6cd58a54b3bdd9c77a26c8a6ed428662e)
+++ PostgreSqlDotnetCore/Controllers/ProductsController.cs	(revision 57fc40271dfe03c973365d9799d1dbf2d4360b8f)
@@ -46,5 +46,5 @@
 
         // GET: Customer/Details/5
-        public ActionResult Details(int? id)
+        public async Task<ActionResult> Details(int? id)
         {
             if (id == null)
@@ -52,4 +52,6 @@
                 return RedirectToAction("NotExist", "Error");
             }
+            UsersClass customerClass = await getCrrentUser(); 
+            ViewBag.isAuthenticated = customerClass;
             ProductsClass prodClass = db.ProductObj.Find(id);
             if (prodClass == null)
Index: PostgreSqlDotnetCore/Controllers/VetCenterController.cs
===================================================================
--- PostgreSqlDotnetCore/Controllers/VetCenterController.cs	(revision d6040ef6cd58a54b3bdd9c77a26c8a6ed428662e)
+++ PostgreSqlDotnetCore/Controllers/VetCenterController.cs	(revision 57fc40271dfe03c973365d9799d1dbf2d4360b8f)
@@ -4,6 +4,5 @@
 using PostgreSqlDotnetCore.Models;
 using Microsoft.AspNetCore.Mvc.Rendering;
-using System.Data;
-using System.Net;
+using System.Threading.Tasks;
 
 namespace PostgreSqlDotnetCore.Controllers
@@ -15,37 +14,34 @@
         }
 
-         public async Task<ActionResult> Create()
-         {
-             UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin);
-             if (customerClass == null)
-             {
-                 return RedirectToAction("AccessDenied", "Error");
-             }
-             var citiess = await db.CitiesObj.ToListAsync();
+        public async Task<ActionResult> Create()
+        {
+            // Set if user is authenticated
+            UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin);
+            ViewBag.isAuthenticated = await getCrrentUser();
+            if (customerClass == null)
+            {
+                return RedirectToAction("AccessDenied", "Error");
+            }
 
-             ViewBag.Citiess = new SelectList(citiess, "id", "name");
+            // Fetch cities for dropdown
+            var citiess = await db.CitiesObj.ToListAsync();
+            ViewBag.Citiess = new SelectList(citiess, "id", "name");
 
-             return View();
-         }
+            return View();
+        }
 
-        // GET: Customer
-        /* public ActionResult Index()
-         {
-             return View(db.VetCentersObj.ToList());
-         }*/
+        public async Task<ActionResult> Index()
+        {
+            var vetCenters = await db.VetCentersObj.ToListAsync();
+            ViewBag.isAuthenticated = User.Identity.IsAuthenticated;
 
-        public ActionResult Index()
-        {
-            var vetCenters = db.VetCentersObj.ToList();
-
-            // Составување на списокот на ветеринарни центри и проверка на автентикацијата
-            ViewBag.isAuthenticated = User.Identity.IsAuthenticated;
+            // Check if the user is an admin
+            UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin);
+            ViewBag.hasAccess = customerClass != null;
 
             return View(vetCenters);
         }
 
-
-        // GET: Customer/Details/5
-        public ActionResult Details(int? id)
+        public async Task<ActionResult> Details(int? id)
         {
             if (id == null)
@@ -53,38 +49,9 @@
                 return RedirectToAction("NotExist", "Error");
             }
-            VetCenter vetClass = db.VetCentersObj.Find(id);
+
+            VetCenter vetClass = await db.VetCentersObj.FindAsync(id);
             if (vetClass == null)
             {
                 return RedirectToAction("NotExist", "Error");
-            }
-            return View(vetClass);
-        }
-
-        // GET: Customer/Create
-        /*  public async Task<ActionResult> CreateAsync()
-          {
-              // check for permission
-              UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin);
-              if (customerClass == null)
-              {
-                  return RedirectToAction("AccessDenied", "Error");
-              }
-              return View();
-          }*/
-
-        // POST: Customer/Create
-        // To protect from overposting attacks, enable the specific properties you want to bind to, for 
-        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
-        [HttpPost]
-        [ValidateAntiForgeryToken]
- 
-
-        public ActionResult Create([Bind(include: "id,name,adress,description,workinghours,phonenumber,latitude,longitude,citiesid")] VetCenter vetClass)
-        {
-            if (ModelState.IsValid)
-            {
-                db.VetCentersObj.Add(vetClass);
-                db.SaveChanges();
-                return RedirectToAction("Index");
             }
 
@@ -92,6 +59,23 @@
         }
 
-        // GET: Customer/Edit/5
-        public async Task<ActionResult> EditAsync(int? id)
+        [HttpPost]
+        [ValidateAntiForgeryToken]
+        public async Task<ActionResult> Create([Bind(include: "id,name,adress,description,workinghours,phonenumber,latitude,longitude,citiesid")] VetCenter vetClass)
+        {
+            if (ModelState.IsValid)
+            {
+                db.VetCentersObj.Add(vetClass);
+                await db.SaveChangesAsync();
+                return RedirectToAction("Index");
+            }
+
+            // If model is invalid, repopulate the cities for dropdown
+            var citiess = await db.CitiesObj.ToListAsync();
+            ViewBag.Citiess = new SelectList(citiess, "id", "name", vetClass.citiesid);
+
+            return View(vetClass);
+        }
+
+        public async Task<ActionResult> Edit(int? id)
         {
             if (id == null)
@@ -99,39 +83,29 @@
                 return RedirectToAction("NotExist", "Error");
             }
-            VetCenter vetClass = db.VetCentersObj.Find(id);
+
+            VetCenter vetClass = await db.VetCentersObj.FindAsync(id);
             if (vetClass == null)
             {
                 return RedirectToAction("NotExist", "Error");
             }
-            // check for permission
+
+            // Check for permission
             UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin);
+            //UsersClass customerClass = await checkAuthorizationAsync();
+            ViewBag.isAuthenticated = await getCrrentUser();
             if (customerClass == null)
             {
                 return RedirectToAction("AccessDenied", "Error");
             }
+
+            // Fetch cities for dropdown
             var citiess = await db.CitiesObj.ToListAsync();
             ViewBag.Citiess = new SelectList(citiess, "id", "name", vetClass.citiesid);
+
             return View(vetClass);
         }
 
-        // POST: Customer/Edit/5
-        // To protect from overposting attacks, enable the specific properties you want to bind to, for 
-        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
         [HttpPost]
         [ValidateAntiForgeryToken]
-        /*
-         public  ActionResult Edit([Bind(include: "id,name,adress,description,workinghours,phonenumber,latitude,longitude,citiesid")] VetCenter vetClass)
-         {
-             if (ModelState.IsValid)
-             {
-                 db.Entry(vetClass).State = EntityState.Modified;
-                 db.SaveChanges();
-                 return RedirectToAction("Index");
-             }
-             return View(vetClass);
-         }*/
-
-        // POST: VetCenter/Edit/5
-
         public async Task<ActionResult> Edit([Bind(include: "id,name,adress,description,workinghours,phonenumber,latitude,longitude,citiesid")] VetCenter vetClass)
         {
@@ -143,4 +117,5 @@
             }
 
+            // If model is invalid, repopulate the cities for dropdown
             var citiess = await db.CitiesObj.ToListAsync();
             ViewBag.Citiess = new SelectList(citiess, "id", "name", vetClass.citiesid);
@@ -149,8 +124,5 @@
         }
 
-
-
-        // GET: Customer/Delete/5
-        public ActionResult Delete(int? id)
+        public async Task<ActionResult> Delete(int? id)
         {
             if (id == null)
@@ -158,20 +130,21 @@
                 return RedirectToAction("NotExist", "Error");
             }
-            VetCenter vetClass = db.VetCentersObj.Find(id);
+
+            VetCenter vetClass = await db.VetCentersObj.FindAsync(id);
             if (vetClass == null)
             {
                 return RedirectToAction("NotExist", "Error");
             }
+
             return View(vetClass);
         }
 
-        // POST: Customer/Delete/5
         [HttpPost, ActionName("Delete")]
         [ValidateAntiForgeryToken]
-        public ActionResult DeleteConfirmed(int id)
+        public async Task<ActionResult> DeleteConfirmed(int id)
         {
-            VetCenter vetClass = db.VetCentersObj.Find(id);
+            VetCenter vetClass = await db.VetCentersObj.FindAsync(id);
             db.VetCentersObj.Remove(vetClass);
-            db.SaveChanges();
+            await db.SaveChangesAsync();
             return RedirectToAction("Index");
         }
@@ -186,22 +159,17 @@
         }
 
-
-        // GET: VetCenter/Search
-        public ActionResult IndexWithSearch(string searchTerm)
+        public async Task<ActionResult> IndexWithSearch(string searchTerm)
         {
             if (string.IsNullOrEmpty(searchTerm))
             {
-                var vetCenters = db.VetCentersObj.ToList();
+                var vetCenters = await db.VetCentersObj.ToListAsync();
                 return View(vetCenters);
             }
             else
             {
-                var searchResults = db.VetCentersObj.Where(vc => vc.name.Contains(searchTerm)).ToList();
+                var searchResults = await db.VetCentersObj.Where(vc => vc.name.Contains(searchTerm)).ToListAsync();
                 return View(searchResults);
             }
         }
-
-
-
     }
 }
