babanazarkamyljanov / BlogWebsiteCore

This is the project solution of blog website
2 stars 1 forks source link

Blog Website "manage roles" section #1

Open gulferkocc opened 1 year ago

gulferkocc commented 1 year ago

Hello, I saw the video you uploaded on YouTube (Blog Website using ASP.NET CORE C#). I'm a computer engineering student, and I'd like to adapt and enhance this website for my project. I'm also curious about the data connection code for the "manage roles" section on your website. Could you please share that with me? @babanazarkamyljanov

babanazarkamyljanov commented 1 year ago

Hi, It is located in Controllers/AdministrationController.cs, and views for that are located in Views/Administration/ folder. You can hide that navigation link depending on user role as per below code: ` @if (signInManager.IsSignedIn(User) && User.IsInRole("Admin")) {

}`

gulferkocc commented 1 year ago

Thank you for your response first. But what I want to ask is which database application you used (SQL, PHP, etc.) and can you provide the codes you used in them and the input data you entered? For example, create table manager id , name varchar...

babanazarkamyljanov commented 1 year ago

I got you.

In my case I didn’t create tables by myself. It is automatically created using Entity Framework Core (aka ORM you can learn about this first) And to connect SQL Server code is in Program.cs file. Where you give local connection string to your database.

And then using EF you can run these commands: Add-Migration InitialCreate Update-Database

Then you can check database, and you will sea all tables

On Mon, Nov 6, 2023 at 19:02 Gülfer KOÇ @.***> wrote:

First of all, thank you for your response. But what I want to ask is which database application you used (SQL, PHP, etc.) and if you can provide the codes you used in them and the input data you entered? For example,create table manager id , name varchar...

— Reply to this email directly, view it on GitHub https://github.com/babanazarkamyljanov/BlogWebsiteCore/issues/1#issuecomment-1794567080, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT3UZFR6TLX7OYWKCDC6AX3YDC7SRAVCNFSM6AAAAAA6ZDNM3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJUGU3DOMBYGA . You are receiving this because you were mentioned.Message ID: @.***>