Index: PostgreSqlDotnetCore/Controllers/BlogController.cs
===================================================================
--- PostgreSqlDotnetCore/Controllers/BlogController.cs	(revision a3ce071e97bad04f989c769589a31427febe9ff3)
+++ PostgreSqlDotnetCore/Controllers/BlogController.cs	(revision 2aea0fddc0f6d0c25f0d44044eeb2ec5930012b9)
@@ -11,72 +11,19 @@
     {
         public BlogController(UserManager<IdentityUser> userManager) : base(userManager)
-
-        {
-
+        {
         }
 
         // GET: Customer
-        /* public async Task<ActionResult> IndexAsync()
-         {
-             // check for permission
-             bool isAuthenticated = User.Identity.IsAuthenticated;
-             if (!isAuthenticated)
-             {
-                 return RedirectToAction("AccessDenied", "Error");
-             }
-             //return View(Enumerable.Empty<UsersClass>());
-             return View(db.BlogPostControllerObj.ToList());
-         }
-        */
-
-        /* public async Task<ActionResult> Index()
-         {
-             // Проверка за автентикација
-             bool isAuthenticated = User.Identity.IsAuthenticated;
-
-             if (!isAuthenticated)
-             {
-                 return RedirectToAction("AccessDenied", "Error");
-             }
-
-             // Список на блог постови
-             var blogPosts = await db.BlogPostControllerObj.ToListAsync();
-
-             // Предавање на ViewBag за проверка на автентикација
-             ViewBag.isAuthenticated = isAuthenticated;
-
-             return View(blogPosts);
-         }*/
-
-        public async Task<ActionResult> Index()
-        {
-            // Проверка за автентикација
+        public async Task<ActionResult> IndexAsync()
+        {
+            // check for permission
             bool isAuthenticated = User.Identity.IsAuthenticated;
-
             if (!isAuthenticated)
             {
                 return RedirectToAction("AccessDenied", "Error");
             }
-
-            // Список на блог постови
-            var blogPosts = await db.BlogUsers.ToListAsync();
-
-            // Вземи тековниот корисник
-            var currentUser = await _userManager.GetUserAsync(User);
-            var customerClass = await db.CustomerObj.SingleOrDefaultAsync(x => x.email == currentUser.Email);
-
-            // Предавање на ViewBag за проверка на автентикација и корисничкиот ID
-            ViewBag.isAuthenticated = isAuthenticated;
-            // no access for standard user
-            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
-
-            ViewBag.CurrentUserId = customerClass?.id;
-
-            return View(blogPosts);
-        }
-
-
-
-
+            //return View(Enumerable.Empty<UsersClass>());
+            return View(db.BlogPostControllerObj.ToList());
+        }
 
         // GET: Customer/Details/5
@@ -89,6 +36,4 @@
             }
             BlogPostConsultation blogClass = db.BlogPostControllerObj.Find(id);
-            UsersClass customerClass = await getCrrentUser();
-            ViewBag.isAuthenticated = customerClass;
             if (blogClass == null)
             {
@@ -99,11 +44,9 @@
             // query
             var query = from st in db.BlogPostAnswersObj
-                        where st.BlogPostConsultationid == blogClass.id
+                        where st.blogpostconsultationid == blogClass.id
                         select st;
             //elenaaa
             var blogAnswers = query.ToList();
             blogClass.BlogPostAnswers = blogAnswers;
-            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
-            ViewBag.CurrentUserId = customerClass?.id;
             return View(blogClass);
         }
@@ -115,22 +58,13 @@
         //}
 
-        /* public ActionResult Create()
-         {
-             var model = new BlogPostConsultation();
-             return View(model);
-         }*/
-
-        public async Task<ActionResult> CreateAsync()
-        {
-
-            // check for permission
-            //UsersClass customerClass = await checkAuthorizationAsync();
-           // ViewBag.isAuthenticated = await getCrrentUser();
-           UsersClass customerClass = await getCrrentUser();
-            // set if is authenticated
-            ViewBag.isAuthenticated = customerClass;
-            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
-
-            return View();
+        public ActionResult Create()
+        {
+            var model = new BlogPostConsultation
+            {
+                //date_askes = DateTime.Now // Поставете го датумот на моменталниот датум
+                // date_askes= DateTime.UtcNow.Date
+                date_askes = DateOnly.FromDateTime(DateTime.UtcNow.Date)
+            };
+            return View(model);
         }
 
@@ -149,17 +83,11 @@
                     var user = await _userManager.GetUserAsync(User);
                     var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
-                   //dodadeno na 25.08
-                    ViewBag.isAuthenticated = await getCrrentUser();
-                    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");
-                    }
+                    // blogClass.date_askes = new DateTime();
+                    // blogClass.date_askes = DateTime.UtcNow;
+                    blogClass.date_askes = DateOnly.FromDateTime(DateTime.UtcNow);
+                    blogClass.users_id = customerClass.id;
+                    db.BlogPostControllerObj.Add(blogClass);
+                    db.SaveChanges();
+                return RedirectToAction("Index");
                 }
                 else
@@ -171,10 +99,4 @@
             return View(blogClass);
         }
-
-
-
-
-
-
 
         // GET: Customer/Edit/5
@@ -192,9 +114,6 @@
             }
 
-            // izbriseno na 26.08
-           UsersClass customerClass = await checkAuthorizationAsync();
-            //dodadeno na 26.08
-           // UsersClass customerClass = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin);
-            ViewBag.isAuthenticated = await getCrrentUser();
+            // check for permission
+            UsersClass customerClass = await checkAuthorizationAsync();
             if (customerClass == null)
             {
@@ -211,8 +130,4 @@
                 }
             }
-            // no access for standard user
-            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
-            ViewBag.OnlyAdminManager1 = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
-
 
             return View(blogClass);
@@ -224,56 +139,28 @@
         [HttpPost]
         [ValidateAntiForgeryToken]
-        /* public ActionResult Edit([Bind(include: "id,date_askes,title,description,users_id")] BlogPostConsultation blogClass)
-         {
-             if (ModelState.IsValid)
-             {
-                 db.Entry(blogClass).State = EntityState.Modified;
-                 db.SaveChanges();
-                 return RedirectToAction("Index");
-             }
-             return View(blogClass);
-         }*/
-
-
-        public async Task<ActionResult> EditAsync(int id, [Bind(include: "id,date_askes,title,description")] BlogPostConsultation blogClass)
+        public ActionResult Edit([Bind(include: "id,date_askes,title,description,users_id")] BlogPostConsultation blogClass)
         {
             if (ModelState.IsValid)
             {
-                var existingBlogClass = await db.BlogPostControllerObj.FindAsync(id);
-                if (existingBlogClass != null)
-                {
-                    
-
-                    // Запамтете ја старата вредност на users_id
-                    blogClass.users_id = existingBlogClass.users_id;
-
-                    db.Entry(existingBlogClass).CurrentValues.SetValues(blogClass);
-                    await db.SaveChangesAsync();
-                    return RedirectToAction("Index");
-                }
-            }
-            return View(blogClass);
-        }
-
-
+                db.Entry(blogClass).State = EntityState.Modified;
+                db.SaveChanges();
+                return RedirectToAction("Index");
+            }
+            return View(blogClass);
+        }
 
         // GET: Customer/Delete/5
-        
         public async Task<ActionResult> DeleteAsync(int? id)
-        {
-            //  UsersClass customerClass = await checkAuthorizationAsync();
-
-            ViewBag.isAuthenticated = await getCrrentUser();
-
+        { 
             if (id == null)
+           {
+               return View(null);
+              //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+           BlogPostConsultation blogClass = db.BlogPostControllerObj.Find(id);
+            if (blogClass == null)
             {
                 return View(null);
-                //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
-            }
-            BlogPostConsultation blogClass = db.BlogPostControllerObj.Find(id);
-            if (blogClass == null)
-            {
-                return View(null);
-                //return HttpNotFound();
+               //return HttpNotFound();
             }
             // check for permission
@@ -293,24 +180,9 @@
                 }
             }
-            // no access for standard user
-            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
-
-            return View(blogClass);
-        }
-
+            return View(blogClass);
+        }
 
         // POST: Customer/Delete/5
-
-        /*
-                [HttpPost, ActionName("Delete")]
-                [ValidateAntiForgeryToken]
-                public ActionResult DeleteConfirmed(int id)
-                {
-                    BlogPostConsultation blogClass = db.BlogPostControllerObj.Find(id);
-                    db.BlogPostControllerObj.Remove(blogClass);
-                    db.SaveChanges();
-                    return RedirectToAction("Index");
-                }
-                */
+     
 
         [HttpPost, ActionName("Delete")]
@@ -318,41 +190,9 @@
         public ActionResult DeleteConfirmed(int id)
         {
-            // Наоѓање на објектот по ID
             BlogPostConsultation blogClass = db.BlogPostControllerObj.Find(id);
-
-            // Проверка дали објектот е пронајден
-            if (blogClass == null)
-            {
-                // Ако објектот не е пронајден, враќаме 404 Not Found или друга соодветна акција
-                return View(null);
-            }
-            //  prvo izbrisi gi site odgovori po sot BlogId e primaren kluc vo drugata tabela
-
-            // query
-            var query = from st in db.BlogPostAnswersObj
-                        where st.BlogPostConsultationid == blogClass.id
-                        select st;
-            //elenaaa
-            var blogAnswers = query.ToList();
-            foreach (BlogPostAnswers answerClass in blogAnswers)
-            {
-                db.BlogPostAnswersObj.Remove(answerClass);
-                db.SaveChanges();
-
-            }
-
-            // Отстранување на објектот ако е пронајден
             db.BlogPostControllerObj.Remove(blogClass);
             db.SaveChanges();
-
-            // Пренасочување на корисникот кон Index страницата
             return RedirectToAction("Index");
         }
-
-        // GET: Customer/Delete/5
-        // GET: Customer/Delete/5
-        // GET: Customer/Delete/5
-
-
 
         protected override void Dispose(bool disposing)
